[erlang-questions] Current time in milliseconds

Robert Virding <>
Sun Dec 7 17:02:22 CET 2008


Basically Megasecs*1000000 + Secs is the number of seconds from 1/1/1970.

So just now I got

1> now().
{1228,665491,453000}
2> (1228*1000000+655491)/(60*60*24*365).
38.960410039320145

which gives us 38.9 yrs from 1/1/1970.

Microsecs is, of course, the number of micro secs in this seconds.

Robert

2008/12/6 Ahmed Ali <>

> Hi,
>
> I found now() function which returns {MegaSecs, Secs, Microsecs}. Now
> the next question is what is MegaSecs? and is Microsecs value is the
> number of microseconds in this second or is it also since zero hour
> (00:00 GMT, January 1, 1970)?
>
> Best regards,
> Ahmed
>
> On Sat, Dec 6, 2008 at 6:31 PM, Ahmed Ali <> wrote:
> > Hi List,
> >
> > I'd like to get the current time in milliseconds. I've been looking
> > around but couldn't find a way to do this in Erlang. Can anyone please
> > help?
> >
> > Best regards,
> >
> > Ahmed
> >
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081207/a915d72f/attachment.html>


More information about the erlang-questions mailing list