Time in Milisecs

matthias@REDACTED matthias@REDACTED
Tue May 8 08:52:30 CEST 2001

 >  My questions is very simple: I need to get time system in Milisec. 
 > For example, function erlang:now() return {MegaSecs, Secs, MicroSecs}, but
 > not Milisec. 

If you have Megasecs, secs and microsecs, you can derive milliseconds
from that, e.g.

1> MS = fun() -> {Mega, S, Micro} = now(), Mega * 1000000000 + S * 1000 + Micro div 1000 end.
2> MS().
3> MS().

This is not terribly efficient.

 > Can I use time Milisec with any Erlang's function???

In general, milliseconds are the unit of choice in erlang and its
libraries. For instance, timeouts in receive statements are in
milliseconds. Some exceptions are now() and timer:tc()

 > The problem is that I am development a Packet Switching Network Simulator
 > Tools, and I need to work with Milisec time unit.

People often decouple simulators from real time, i.e. time elapsed in
the simulation is not the same as time elapsed on your wall clock.


More information about the erlang-questions mailing list