[Rd] Buglet in handling times in R-3.5.1

Marco Atzeri m@rco@@tzeri @ending from gm@il@com
Tue Oct 9 18:59:37 CEST 2018


Am 09.10.2018 um 16:56 schrieb Russell, George:
> Dear R developers,
> 
> I have found a minute bug in R-3.5.1 (Windows version), about how times not an exact number of seconds are displayed.
>> as.POSIXct("1969-01-01 01:00")+0.3
> [1] "1969-01-01 01:00:01 CET"
>> as.POSIXct("1970-01-01 01:00")+0.3
> [1] "1970-01-01 01:00:00 CET"
> 
> So for 1969, adding 0.3 of a second means you round UP, for 1970 you round DOWN. But I think it should be consistent.

More likely a bug in the underlining C library
The Cygwin build does not show the problem

 > as.numeric(as.POSIXct("1969-01-01 01:00")+0.3)
[1] -31535999.7
 > as.POSIXct("1969-01-01 01:00")+0.3
[1] "1969-01-01 01:00:00 CET"
 > as.numeric(as.POSIXct("1969-01-01 01:00"))
[1] -31536000
 > as.POSIXct("1969-01-01 01:00")
[1] "1969-01-01 01:00:00 CET"

 > R.version
                _
platform       x86_64-unknown-cygwin
arch           x86_64
os             cygwin
system         x86_64, cygwin
status
major          3
minor          5.1
year           2018
month          07
day            02
svn rev        74947
language       R
version.string R version 3.5.1 (2018-07-02)
nickname       Feather Spray


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus



More information about the R-devel mailing list