Opened 6 years ago

Closed 15 months 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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

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 6 years ago by igloo

  • Component changed from Compiler to libraries (other)
  • Difficulty set to Unknown
  • Milestone set to 6.10.1

Thanks for the report

comment:2 Changed 6 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 6 years ago by simonmar

  • Component changed from libraries (other) to libraries (old-time)
  • Milestone changed from 6.10.1 to _|_

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 6 years ago by igloo

See also #2479

comment:5 Changed 15 months ago by morabbin

  • Type of failure set to 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 15 months ago by simonmar

This probably shouldn't happen:

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

comment:7 Changed 15 months ago by morabbin

Dang; 64bit overflow. D'oh!

comment:8 Changed 15 months ago by igloo

  • Resolution set to wontfix
  • Status changed from new to closed

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.