1096 – Mysterious hang with toUTCString + UTCtoLocalTime + d_time_nan

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1096 - Mysterious hang with toUTCString + UTCtoLocalTime + d_time_nan
Summary: Mysterious hang with toUTCString + UTCtoLocalTime + d_time_nan
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords:
Depends on:
Blocks:
Reported: 2007年04月05日 09:28 UTC by Daniel Keep
Modified: 2014年02月16日 15:26 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Daniel Keep 2007年04月05日 09:28:27 UTC
Using the below program:
-----
module timetest;
import std.stdio;
import std.date;
void main(char[][] args)
{
 foreach( arg ; args[1..$] )
 {
 auto time = parse(arg);
 time = UTCtoLocalTime(time); // Line 11
 auto str = toUTCString(time); // Line 12
 writefln(`"%s" = %s (%s)`, arg, time, str);
 }
}
-----
If I compile this and call it like this:
$ timetest "Jan 1"
The program hangs. If I comment out UTCtoLocalTime, and re-run with the same arguments, it outputs
"Jan 1" = -9223372036854775808 (Invalid Date)
Now it gets weird. If I un-comment line 11 and comment line 12 (replace the "str" arg to writefln with ""), I get:
"Jan 1" = -9223372036818775808 ()
And if I then comment-out line 11 again, rerun, I get:
"Jan 1" = -9223372036854775808 ()
So, for some reason, toUTCString fails on d_time_nan iif it has been passed through UTCtoLocalTime, despite the fact that UTCtoLocalTime doesn't change the value.
Comment 1 Walter Bright 2007年04月20日 13:18:46 UTC
Fixed DMD 1.013


AltStyle によって変換されたページ (->オリジナル) /