As Joshua Ulrich already said, the fractional part of the seconds is not lost,
but not displayed by default. If you want to see the fractional part, set the
option "digit.secs" to the desired number of decimal places.
But at least on my system I couldn't get more than 7 decimal places:
#============================================================
# With option "digit.secs"=NULL
options(digits.secs=NULL)
t1 <- as.POSIXct(as.numeric(substr(1438293919327731275,1,10)),
origin="1970-01-01")
t2 <- strptime(paste(as.character(t),
substr(1438293919327731275,11,13),
sep="."),
"%Y-%m-%d %H:%M:%OS")
t3 <- strptime(paste(as.character(t),
substr(1438293919327731275,11,19),
sep="."),
"%Y-%m-%d %H:%M:%OS")
t1
t2
t3
t2-t1
t3-t1
#==============================================================
# With option "digit.secs"=9
options(digits.secs=9)
t1 <- as.POSIXct(as.numeric(substr(1438293919327731275,1,10)),
origin="1970-01-01")
t2 <- strptime(paste(as.character(t),
substr(1438293919327731275,11,13),
sep="."),
"%Y-%m-%d %H:%M:%OS")
t3 <- strptime(paste(as.character(t),
substr(1438293919327731275,11,19),
sep="."),
"%Y-%m-%d %H:%M:%OS")
t1
t2
t3
t2-t1
t3-t1
Result:
> #============================================================
> # With option "digit.secs"=NULL
>
> options(digits.secs=NULL)
> t1 <- as.POSIXct(as.numeric(substr(1438293919327731275,1,10)),
+ origin="1970-01-01")
> t2 <- strptime(paste(as.character(t),
+ substr(1438293919327731275,11,13),
+ sep="."),
+ "% ..." ... [TRUNCATED]
> t3 <- strptime(paste(as.character(t),
+ substr(1438293919327731275,11,19),
+ sep="."),
+ "% ..." ... [TRUNCATED]
> t1
[1] "2015-07-31 00:05:19 CEST"
> t2
[1] "2015-07-31 00:05:19 CEST"
> t3
[1] "2015-07-31 00:05:19 CEST"
> t2-t1
Time difference of 0.3269999 secs
> t3-t1
Time difference of 0.3277311 secs
> #==============================================================
> # With option "digit.secs"=9
>
> options(digits.secs=9)
> t1 <- as.POSIXct(as.numeric(substr(1438293919327731275,1,10)),
+ origin="1970-01-01")
> t2 <- strptime(paste(as.character(t),
+ substr(1438293919327731275,11,13),
+ sep="."),
+ "% ..." ... [TRUNCATED]
> t3 <- strptime(paste(as.character(t),
+ substr(1438293919327731275,11,19),
+ sep="."),
+ "% ..." ... [TRUNCATED]
> t1
[1] "2015-07-31 00:05:19 CEST"
> t2
[1] "2015-07-31 00:05:19.327 CEST"
> t3
[1] "2015-07-31 00:05:19.327731 CEST"
> t2-t1
Time difference of 0.3269999 secs
> t3-t1
Time difference of 0.3277311 secs