Home My Page Projects Code Snippets Project Openings SML/NJ Bugs
Summary Activity Tracker Lists

[#138] Incorrect behavior for Date.fromTimeLocal

Date:
2015-09-01 13:57
Priority:
3
State:
Closed
Submitted by:
Bug Submitter (webuser)
Assigned to:
John Reppy (jhr)
Machine Architecture:
None
Operating System:
Generic Unix
Component:
Basis Library
Resolution:
Fixed
Severity:
Major
OS Version:
SML/NJ Version:
110.78
Keywords:
Dates
URL:
Transcript (of reproduction):
Standard ML of New Jersey v110.78 [built: Sun Dec 21 16:30:08 2014] - val y2k = Date.date { = year= 2000, month= Date.Jan, day= 1, hour= 0, minute= 0, second= 0, = offset= SOME Time.zeroTime = }; [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [autoloading done] val y2k = DATE {day=1,hour=14,isDst=SOME false,minute=0,month=Jan, offset=SOME (TIME {usec=#}),second=0,wday=Sat,yday=0,year=2000} : Date.date - val _ = print(concat[ = "The UTC millenium (local time): ", = Date.toString (Date.fromTimeLocal (Date.toTime y2k)), "\n" = ]); The UTC millenium (local time): Sat Jan 1 20:00:00 2000 -
Source (for reproduction):
val y2k = Date.date { year= 2000, month= Date.Jan, day= 1, hour= 0, minute= 0, second= 0, offset= SOME Time.zeroTime }; val _ = print(concat[ "The UTC millenium (local time): ", Date.toString (Date.fromTimeLocal (Date.toTime y2k)), "\n" ]);
Summary:
Incorrect behavior for Date.fromTimeLocal

Detailed description
The function Date.fromTimeLocal returns incorrect results.
The expected result will depend on the time zone in which
it is run. These tests below were run in the Pacific
Time Zone.
Additional comments:
The expected output is

The UTC millenium (local time): Fri Dec 31 16:00:00 1999

(verified against both mosml and mlton)

Submitted via web form by John Reppy <jhr@cs.uchicago.edu>

Comments:

Message  ↓
Date: 2015-09-28 15:41
Sender: John Reppy

Fixed for 110.79

Attached Files:

Changes

Field Old Value Date By
status_idOpen2015-09-28 15:41jhr
close_dateNone2015-09-28 15:41jhr
ResolutionNone2015-09-28 15:41jhr
assigned_tonone2015-09-01 14:12jhr
detailsThe function Date.fromTimeLocal returns incorrect results. The expected result will depend on the time zone in which it is run. These tests below were run in the Pacific Time Zone. Additional comments: The expected output is The UTC millenium (local time): Fri Dec 31 16:00:00 1999 (verified against both mosml and mlton) Submitted via web form by John Reppy <jhr@cs.uchicago.edu> 2015-09-01 14:12jhr
SeverityCosmetic2015-09-01 14:12jhr
Transcript (of reproduction)Standard ML of New Jersey v110.78 [built: Sun Dec 21 16:30:08 2014] - val y2k = Date.date { = year= 2000, month= Date.Jan, day= 1, hour= 0, minute= 0, second= 0, = offset= SOME Time.zeroTime = }; [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [autoloading done] val y2k = DATE {day=1,hour=14,isDst=SOME false,minute=0,month=Jan, offset=SOME (TIME {usec=#}),second=0,wday=Sat,yday=0,year=2000} : Date.date - val _ = print(concat[ = "The UTC millenium (local time): ", = Date.toString (Date.fromTimeLocal (Date.toTime y2k)), "\n" = ]); The UTC millenium (local time): Sat Jan 1 20:00:00 2000 - 2015-09-01 14:12jhr
Source (for reproduction)val y2k = Date.date { year= 2000, month= Date.Jan, day= 1, hour= 0, minute= 0, second= 0, offset= SOME Time.zeroTime }; val _ = print(concat[ "The UTC millenium (local time): ", Date.toString (Date.fromTimeLocal (Date.toTime y2k)), "\n" ]); 2015-09-01 14:12jhr