Opened 15 years ago

Closed 14 years ago

#24544 closed defect (fixed)

erlang:localtime_to_universaltime returns wrong timestamp when using DST

Reported by: dcestari@… Owned by: bfulgham@…
Priority: Normal Milestone:
Component: ports Version: 1.8.2
Keywords: haspatch Cc: pokui@…
Port: erlang

Description

erlang:localtime_to_universaltime calls mktime on the host OS and interpretes the result as an unix timestamp.

the thing is, on BSD (there for, on OS X) the mktime function returns -1 when the tm_dst is 1 and the current timezone doesn't have DST.

erlang doesn't check for this abnormal result and interpretes it wrongly as a second before unix epoch.

I attached a patch that checks for this result and tries to get the timestamp without the tm_dst.

Attachments (1)

patch-erts_emulator_beam_erl_time_sup.c.diff (404 bytes) - added by dcestari@… 15 years ago.
check the result of mktime and try to get a timestamp without dst if needed

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by dcestari@…

check the result of mktime and try to get a timestamp without dst if needed

comment:1 Changed 15 years ago by mf2k (Frank Schima)

Keywords: haspatch added
Owner: changed from macports-tickets@… to bfulgham@…

comment:2 Changed 14 years ago by pokui@…

Cc: pokui@… added

Cc Me!

comment:3 Changed 14 years ago by bfulgham@…

Resolution: fixed
Status: newclosed

Corrected in sources for R14B01 (upstream sources patched.)

Note: See TracTickets for help on using tickets.