[erlang-bugs] erlang:localtime_to_universaltime return wrong value when pass "true" to the second parameter.

tien lex <>
Tue May 13 18:07:23 CEST 2008


Hi,
Here is my environment:
ti@~: uname -a
FreeBSD  7.0-RELEASE FreeBSD 7.0-RELEASE #0: Tue Apr  8 07:57:43 ICT
2008     :/usr/obj/usr/src/sys/EXTCOMPAT  i386

1> os:getenv("TZ").
"Asia/Saigon"
7> DateTime = {{2008,5,5},{1,1,1}}.
{{2008,5,5},{1,1,1}}
9> calendar:local_time_to_universal_time_dst(DateTime).
** exception error: bad argument
     in function  erlang:universaltime_to_localtime/1
        called as
erlang:universaltime_to_localtime({{1969,12,31},{23,59,59}})
     in call from calendar:local_time_to_universal_time_dst/1

10> erlang:localtime_to_universaltime(DateTime, true).
{{1969,12,31},{23,59,59}}

11> erlang:localtime_to_universaltime(DateTime, false).
{{2008,5,4},{18,1,1}}

And below is the result of zdump command on /etc/localtime file:
ti@~: zdump -v /etc/localtime
/etc/localtime  Fri Dec 13 20:45:52 1901 UTC = Sat Dec 14 03:52:32 1901 LMT
isdst=0 gmtoff=25600
/etc/localtime  Sat Dec 14 20:45:52 1901 UTC = Sun Dec 15 03:52:32 1901 LMT
isdst=0 gmtoff=25600
/etc/localtime  Fri Jun  8 16:53:19 1906 UTC = Fri Jun  8 23:59:59 1906 LMT
isdst=0 gmtoff=25600
/etc/localtime  Fri Jun  8 16:53:20 1906 UTC = Fri Jun  8 23:59:40 1906 SMT
isdst=0 gmtoff=25580
/etc/localtime  Fri Mar 10 16:54:39 1911 UTC = Sat Mar 11 00:00:59 1911 SMT
isdst=0 gmtoff=25580
/etc/localtime  Fri Mar 10 16:54:40 1911 UTC = Fri Mar 10 23:54:40 1911 ICT
isdst=0 gmtoff=25200
/etc/localtime  Tue Apr 30 16:59:59 1912 UTC = Tue Apr 30 23:59:59 1912 ICT
isdst=0 gmtoff=25200
/etc/localtime  Tue Apr 30 17:00:00 1912 UTC = Wed May  1 01:00:00 1912 ICT
isdst=0 gmtoff=28800
/etc/localtime  Thu Apr 30 15:59:59 1931 UTC = Thu Apr 30 23:59:59 1931 ICT
isdst=0 gmtoff=28800
/etc/localtime  Thu Apr 30 16:00:00 1931 UTC = Thu Apr 30 23:00:00 1931 ICT
isdst=0 gmtoff=25200
/etc/localtime  Mon Jan 18 03:14:07 2038 UTC = Mon Jan 18 10:14:07 2038 ICT
isdst=0 gmtoff=25200
/etc/localtime  Tue Jan 19 03:14:07 2038 UTC = Tue Jan 19 10:14:07 2038 ICT
isdst=0 gmtoff=25200
ti@~:

It worked great  before i change the time zone.

Regards,
Tien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20080513/7a7dad39/attachment.html>


More information about the erlang-bugs mailing list