Opened 9 years ago

Closed 4 years ago

#2425 closed bug (wontfix)

Crash constructing a ClockTime too far into the future

Reported by: wagstaff Owned by:
Priority: normal Milestone:
Component: libraries/old-time Version: 6.8.3
Keywords: Cc:
Operating System: Windows Architecture: x86
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Per summary. Type this in to GHCi:

show (TOD 12312323123 0)

and it crashes.

Similar bad behaviour with compiled code.

Ah, looks like it goes wrong when the bits wrap. (TOD 2147483647 0) is OK, but (TOD 2147483648 0) falls apart.

Change History (8)

comment:1 Changed 9 years ago by igloo

Component: Compilerlibraries (other)
difficulty: Unknown
Milestone: 6.10.1

Thanks for the report

comment:2 Changed 9 years ago by wagstaff

Google suggests that System.Time may be deprecated (though this is not at all clear to me); and it turns out that I can do what I want with posixSecondsToUTCTime anyway.

So this isn't important to me, and if System.Time really is deprecated then perhaps it's not important to anyone?

comment:3 Changed 9 years ago by simonmar

Component: libraries (other)libraries (old-time)
Milestone: 6.10.1_|_

This is an instance of the infamous "2038 bug".

System.Time is indeed deprecated, you should use the new time package preferably.

comment:4 Changed 9 years ago by igloo

See also #2479

comment:5 Changed 4 years ago by morabbin

Type of failure: None/Unknown

Current version of System.Time doesn't suffer from this:

Orac:~/work/tickets $ ghci
...
Prelude> :m System.Time
Prelude System.Time> TOD 214748365333 0
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package old-time-1.1.0.1 ... linking ... done.
Sat Feb  8 03:42:13 PST 8775
Prelude System.Time> 

comment:6 Changed 4 years ago by simonmar

This probably shouldn't happen:

Prelude System.Time> TOD 9223372036854775808 0
Sun *** Exception: toCalendarTime: illegal month value: 43282745

comment:7 Changed 4 years ago by morabbin

Dang; 64bit overflow. D'oh!

comment:8 Changed 4 years ago by igloo

Resolution: wontfix
Status: newclosed

old-time is now only included in a GHC tree because haskell98 depends on it. I don't think it's worth spending time fixing it at this point.

Note: See TracTickets for help on using tickets.