problem using bif now().

peter@REDACTED peter@REDACTED
Thu May 1 17:00:30 CEST 2003


1 year is about 31 000 000 secs. 1/31 of a year seems to be 12 days.
All seems ok to me...

/Peter

> I am writing my first production erlang program and need to measure the
> duration of calls hitting a server. I am using the bif now() to get the
> mega-seconds, seconds and micro-seconds from a base time reference.
>
> The problem is this. The following code fragment causes the CPU useage
> to continually increase, eventually consuming all the CPU on the
> machine.
>
> {MSec,Sec,MicoSec} = erlang:now(),
> Read_time = (Msec*1000000)+Sec+(MicoSec/1000000),
>
> but the following does not have the problem.
>
>
> {MSec,Sec,MicoSec} = erlang:now(),
> Read_time = Sec+(MicoSec/1000000),
>
> However, now about every 12 days the seconds values wraps back to zero.
>
> Is this a bug that should be reported, or is there a problem in my
> code.?
>
> I am running erlang R9B-0 on Linux Redhat 7.3.
>
> --
>  <mark.geib@REDACTED>
> Cheyenne Software Engineering






More information about the erlang-questions mailing list