erlang time handling (in calendar.erl and erlang.erl)

Håkan Stenholm hakan.stenholm@REDACTED
Sat Jan 29 22:14:55 CET 2005


I have recently been working a lot with date and time oriented problems 
- implementing CPL time-switches (RFC 3880 - Call Processing Language 
(CPL): A Language for User Control of Internet Telephony Services).

This involved, among other things, processing iCalendar (RFC 2445 - 
Internet Calendaring and Scheduling Core Object Specification) date and 
time data types, which allow for times containing leap seconds - this 
lead me to wonder how exactly erlang deals with this issues.

Looking at the code in calendar.erl I would assume that the seconds 
retrieved with erlang:now() are in Unix time 
(http://en.wikipedia.org/wiki/Unix_time) - i.e. all days are treated as 
if they are 24*60*60 seconds long and leap seconds[1] are handled by 
extending certain seconds, i.e. reporting 23:59:59 twice instead of 
23:59:59 followed by 23:59:60.

Is this a correct assumption ? I assume that ERTS uses something like 
ctime() or gmtime() internally ?



[1]: assuming that time is measured with sufficient precision (e.g. by 
syncing against atom clocks with ntp) for leap seconds to matter.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1101 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050129/2e2511cc/attachment.bin>


More information about the erlang-questions mailing list