Dear list,

I'm a bit puzzled by an ambiguity with respect to the representation of 
micro-/milliseconds when using 'POSIXlt' objects.

It seems that the last digit of  the 'sec' attribute sometimes seems to 
differ from the digits shown when printing the 'POSIXlt' object. You'll 
find a little SO post with some example code here: 
http://stackoverflow.com/questions/11725517/ambiguity-with-posixlt-representation-when-microseconds-are-included.

In case you don't want to have a look at that, here's another short example:

|opts<-  options(digits.secs=6)
x<-  "2012-07-30 12:10:09.123123"

posix<-  as.POSIXlt(x,  tz="Europe/Berlin")

>  posix
[1]  "2012-07-30 12:10:09.123122 Europe/Berlin"

>  posix$sec
[1]  9.123123
|

# Manually changing the 'sec' attribute

|posix$sec<-  9.123122
>  posix
[1]  "2012-07-30 12:10:09.123122 Europe/Berlin"
# Still '.123122'

posix$sec<-  9.123124
>  posix
[1]  "2012-07-30 12:10:09.123124 Europe/Berlin"
# Now it's '.123124' in both 'representations'
|


Thanks a lot for any clarification on this!
Janko

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to