[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Computing Time

Martin Schultz <martin.schultz@dkrz.de> writes:
> JULDAY will give you fractional days as an answer. To convert this back
> into
> days, hours, minutes, etc., you can do:
>    days = fix(diff)   ; or long() if you desire
>    hour = fix( (diff-days)*24. )
>    minute = fix( (diff-days-hour/24.)*1440. )
>    second = fix( (diff-days-hour/24.-minute/1440.)*86400. )
> just that you may run into roundoff problems here or there. And this is
> why you should probably follow Liam's advice and use the JHU APL
> routines.

Would it be wiser to use FLOOR() instead of FIX(), to handle negative
time differences?  This always gets a little sticky.


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response