[R] Get current time in numeric form?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jan 23 15:27:34 CET 2001
> From: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk>
> Date: 23 Jan 2001 14:24:38 +0100
>
[...]
> Just to complete the discussion on date parsing,
>
> unclass(as.POSIXct(strptime(date(),"%c")))
>
> or
>
> as.POSIXct(strptime(date(),"%c")) - structure(0,class="POSIXct")
>
> gives the time in seconds since the beginning of time() (generally Jan
> 1 1970 0:00:00 GMT on Unixen).
It is easier to use unclass(Sys.time()), which gives this directly.
The base is always `the epoch', as given by Peter. Unless your clock
is set wrong (possible) that should be the correct value, the problem
being the conversions done in printing it.
> However, I think proc.time()[3] is more relevant for your needs.
It is higher accuracy too (ca 0.01 secs).
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list