[erlang-questions] calendar:local_time_to_universal_time_dst/1 - what this is for?

Kenji Rikitake kenji.rikitake@REDACTED
Mon Sep 15 15:08:27 CEST 2008


Raimo and all:

In the message <20080915121116.GA17553@REDACTED>
dated Mon, Sep 15, 2008 at 02:10:53PM +0200,
Raimo Niskanen <raimo+erlang-questions@REDACTED> writes:
> It is rather clear in the manual:
> http://www.erlang.org/doc/man/calendar.html

Thanks Raimo for your time.  
I should have read the erl_time_sup.c more thoroughly.

So the following four cases may actually happen for
calendar:local_time_to_universal_time_dst/1 results:

1) UTC UtDst is local non-DST DateTime
   (when in non-DST)
   returning [DateTimeUTC] ([UtDst])

2) UTC Ut is local DST DateTime
   (when in DST)
   returning [DateTimeUTC] ([Ut])

3) UTC UtDst is local DST DateTime
   or
   UTC Ut is local non-DST DateTime
   (when switching from DST to non-DST)
   returning [DstDateTimeUTC, DateTimeUTC] ([UtDst, Ut])

4) no UTC mapping for a local DST DateTime
   (when switching from non-DST to DST)
   returning []

I was only thinking about mapping from UTC to a local time, so I was
confused.

> > * Why you need to double-check the whole time difference?
> 
> I do not understand this questions.

I was trying to ask why you needed
to convert from the local time to UTC
and to convert back from UTC to the local time.
I now understand it was to find out the four possible matching cases of
non-DST and DST.

BTW

> > Maybe I'm perplexed just because I've never tried hard to code DST
> > handling programs (Japan has no DST since 1950s).
> 
> Lucky you.

Japan was actually implementing "summer time" during 1948 to 1952, but
the older people (I was born in 1960s) told me they had to work one hour
longer and that was it :-p

And I should confess I once lived in Colorado, USA so I should have
known what the DST was.  My apologies.

Regards,
Kenji Rikitake



More information about the erlang-questions mailing list