Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #307 (closed defect: fixed)

Opened 2 years ago

Last modified 1 year ago

system/localtime example gives wrong result on darwin

Reported by: Carlos Assigned to: kris
Priority: normal Milestone: 0.97 RC 1
Component: Tango Version: trunk
Keywords: Cc:

Description

$ system/localtime && date
Sat, Mar 03 13:35:53 GMT06:00 2007
Sat Mar  3 14:13:04 CST 2007

expected output (kinda):

Sat, Mar 03 14:13:04 GMT-06:00 2007

Change History

03/09/07 19:30:08 changed by kris

  • status changed from new to assigned.
  • milestone set to 0.97 RC 1.

04/05/07 18:51:16 changed by Carlos

This isn't fixed yet. However, I found out something:

$ system/localtime
Thu, Apr 05 17:35:55 GMT06:00 2007

$ date
Thu Apr  5 17:46:57 CDT 2007

$ system/localtime
Thu, Apr 05 17:35:55 GMT06:00 2007

$ date
Thu Apr  5 17:47:36 CDT 2007

Notice how date gives different results (obviously), but system/localtime output doesn't change. Weird...

04/06/07 14:12:31 changed by kris

Very weird :)

04/10/07 04:35:02 changed by larsivi

There is no such caching of time on linux - but I'm seeing wrong DST values (probably). Will try to find a reason for that.

04/10/07 18:22:02 changed by kris

On darwin, this c-lib code gives different results between D and C compilers. The C compiler is correct, whereas the D compiler is all wrong:

time_t rawtime; 
tm* ptm; rawtime = tango.stdc.time.time(null); 
ptm = tango.stdc.time.localtime(&rawtime); 
return cast(Interval) -ptm.tm_gmtoff;

Kashia notes that the function decls appear to correct

04/12/07 13:59:05 changed by kris

  • milestone changed from 0.97 RC 1 to 0.98 RC 2.

have to delay this for now ...

04/12/07 15:26:20 changed by afb

I can't see any differences between tango.stdc.time and time.h

 C 
===
1176405887
21:24:47 CEST (7200)
2F 0 0 0 18 0 0 0 15 0 0 0 C 0 0 0 3 0 0 0 6B 0 0 0 4 0 0 0 65 0 0 0 1 0 0 0 20 1C 0 0 50 21 80 1 

 D 
===
1176405887
21:24:47 CEST (7200)
2F 0 0 0 18 0 0 0 15 0 0 0 C 0 0 0 3 0 0 0 6B 0 0 0 4 0 0 0 65 0 0 0 1 0 0 0 20 1C 0 0 50 C9 80 1 

For raw time, printed time/offset, and hexdump of tm struct.

04/14/07 01:44:08 changed by kris

  • status changed from assigned to closed.
  • version set to trunk.
  • resolution set to fixed.
  • milestone changed from 0.98 RC 2 to 0.97 RC 1.

Turned out to be a codegen bug in GDC 0.23 with float types. Thanks to Carlos for tracking it down

04/14/07 15:20:04 changed by Carlos