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

Bengt Kleberg <>
Wed May 14 09:53:25 CEST 2008


Greetings,

If it helps I can report that the examplea work _without_ errors on my
machine:
Linux seasc0642 2.6.16.53-0.16-smp #1 SMP Tue Oct 2 16:57:49 UTC 2007
i686 i686 i386 GNU/Linux


bengt

On Tue, 2008-05-13 at 23:07 +0700, tien lex wrote:
> 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 
>   
> 
> 
> _______________________________________________
> erlang-bugs mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-bugs




More information about the erlang-bugs mailing list