How to calculate Time

Chandrashekhar Mullaparthi Chandrashekhar.Mullaparthi@REDACTED
Mon Jun 10 10:04:04 CEST 2002


Checkout the manpage for calendar. It has a function
calendar:time_difference/2

If you want to calculate the difference between two values of now() - the
following code will return the difference in milliseconds.

now_diff(Then, Now) ->
    {M, S, U} = Then,
    Then_ms = trunc(M*1000000000+S*1000+U/1000),
    {M1, S2, U2} = Now,
    Now_ms = trunc(M1*1000000000+S2*1000+U2/1000),
    Now_ms - Then_ms.

cheers
Chandru

-----Original Message-----
From: K Chandra Shekhar [mailto:kchandrashekhar@REDACTED]

hi guys,

Is there any BIF to calculate the time(in secs or mins)  
for which an alarm is active ?

I am stuck up trying to find the solution.

I dtored the starting time in one variable and the time at 
which the alaram is cleared in another....

Subtracting the two does not give any results...

Please help me.

Chandra Shekhar



NOTICE AND DISCLAIMER:
This email (including attachments) is confidential.  If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents.  We cannot accept liability for any breaches of
confidence arising through use of email.  Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions.  We will not accept responsibility for any commitments
made by our employees outside the scope of our business.  We do not warrant
the accuracy or completeness of such information.



More information about the erlang-questions mailing list