[R] timeDate

Martin Maechler maechler at stat.math.ethz.ch
Tue Nov 23 17:04:41 CET 2004


>>>>> "james" == james holtman <james.holtman at convergys.com>
>>>>>     on Tue, 23 Nov 2004 10:39:04 -0500 writes:

    james> You might want to check out 'chron'.  This stores the
    james> time as days and fractions of a day.

    james> If you take the current date,

    >> as.numeric(chron(dates.="11/23/2004"))
    james> [1] 12745
    >>

    james> you get the value above.  If you change this to
    james> millisecond, you get

    >> as.numeric(chron(dates.="11/23/2004")) * 86400 * 1000
    james> [1] 1.101168e+12
    >>

    james> this value requires 46 bits and since a floating
    james> point number has 54 bits of value, 

no, only 52 bits  (64 = 52+1+12+1) with sign bits for exponent
and mantissa.

    james> it should be enough to give you millisecond resolution and still
    james> maintain the 'date'




More information about the R-help mailing list