problem using bif now().
mark.geib@REDACTED
mark.geib@REDACTED
Thu May 1 17:05:20 CEST 2003
Peter,
I agree, the values returned by now() are correct. The problem is that
if I use the mega-second value in my calculation then the program uses
more and more cpu as it runs.
Mark.
On Thu, 2003-05-01 at 09:00, peter@REDACTED wrote:
> 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
--
<mark.geib@REDACTED>
Cheyenne Software Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030501/b7ba04e6/attachment.bin>
More information about the erlang-questions
mailing list