cheap equivalent of now()

Christian S <>
Wed May 24 19:27:59 CEST 2006


I was waiting for others' comments, but as they lacked, here goes.

First of, do you really have a problem with too many gettimeofday() syscalls
from your
erlang program, or is it just a premature guess of a bottleneck in some code
you
will write? I suggest you go with erlang:now() and see.

If your guess would indeed be true, then you could look at the 'timer'
module. There
are some functions there that could be interesting for 'driving' a timer you
keep in a
process.

On 5/22/06, Gaspar Chilingarov <> wrote:
>
> Hi all!
>
> I've searched erlang documentation but without any positive results...
>
> Are there a way to get unix_timestamp at low cost? Even not-so-precise
> as erlang:now() - it may be even a little bit illegal - say several
> seconds back of real time ...
>
> I wish to have time recorded with a several second precision, but making
> too much erlang:now() calls is not a good idea -- at least
> gettimeoffay() for C applications can create serios slowdown of program.
>
> Seems, that the only way to achieve this is a creating standalone
> process and requesting timestamp from it?
>
>
> --
> Gaspar Chilingarov
>
> System Administrator,
> Network security consulting
>
> t +37491 419763 (mob)
> i 63174784
> e 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060524/8b29d0c0/attachment.html>


More information about the erlang-questions mailing list