Skip to content

manipulating the Date & Time classes

4 messages · Mike Williamson, Daniel Cegiełka, Jeff Ryan +1 more

#
Firstly, don't double post.
On Tue, Feb 8, 2011 at 2:24 PM, Mike Williamson <this.is.mvw at gmail.com> wrote:
You didn't say what your OS is, but two things spring to mind.  Why
are you calling 'unlist' on an object that isn't a list and ... "it
works for me":
[1] "2011-02-08 14:46:24.262146 CST"
If it is just numeric, it shouldn't have any attribute and since the
origin isn't global, you're sort of stuck. You can keep track of it
yourself, or just leave it as the standard unix epoch.
[1] "2011-02-08 14:59:26.40236 CST"
[1] "2011-02-08 14:59:36.762224 CST"

Again, works for me.

R.version
               _
platform       x86_64-apple-darwin10.2.0
arch           x86_64
os             darwin10.2.0
system         x86_64, darwin10.2.0
status
major          2
minor          12.0
year           2010
month          10
day            15
svn rev        53317
language       R
version.string R version 2.12.0 (2010-10-15)

  
    
#
Mike,
On Feb 8, 2011, at 3:24 PM, Mike Williamson wrote:

            
Same answer as Jeff said - it works for me. When posting claims like this it's good to provide some evidence like a reproducible example with details such as the version of R you used, OS etc.
You may want to read up on times a bit - POSIX time (aka unix time) *is* defined as number of seconds elapsed since midnight UTC 1970/1/1. That is also the internal representation of POSIXct (see ?POSIXct) that you get when unclassing it (not unlisting).
And it would be fatal if it did. When you have a number there is no way of knowing what the origin is, that's why it has to be specified. There are many different numeric times with various origins (e.g. Apple used to have its own one before OS X, Excel uses 1900 etc. - see Epoch).
In general, there is no way. *If* your numbers come from unclassing POSIXct then you can simply set the class back - which avoid other hassles such as the fact that you have no idea about the target time zone of the original number otherwise.
POSIX time is POSIX time (aka unix time) - that's where the name comes from! If that definition changes, we'll see more issues than your code ;).
Again, I don't believe you:
[1] "2011-02-08 17:17:47 EST"
[1] "2011-02-08 17:17:56 EST"
Time difference of 9 secs
Please do provide some real evidence, like reproducible examples. So far none of your claims was verifiable.

Cheers,
Simon