[Rd] Buglet in handling times in R-3.5.1

Emil Bode emil@bode @ending from d@n@@kn@w@nl
Tue Oct 9 18:12:41 CEST 2018


Here on my Mac it looks worse: not a rounding difference, but an off-by-one error for fractional seconds before 1970, looks like the conversion to POSIXlt is doing something wrong:

Options(digits=12)
as.numeric(as.POSIXlt(as.POSIXct('1969-01-01')))
[1] -31539600
# As expected
as.numeric(as.POSIXlt(as.POSIXct('1969-01-01')+.1))
[1] -31539598.9
# An additional second disappears (and no, there was no (negative) leap second)

I'm not enough at home in C to get to the core of it, the problem is in the .Internal call
Hoping somebody can investigate further.
Specs: R 3.5.1; macOS 10.13.6

Best regards, 
Emil Bode
 

On 09/10/2018, 17:27, "R-devel on behalf of Russell, George" <r-devel-bounces using r-project.org on behalf of g.russell using eos-solutions.com> wrote:

    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.
    
    At the end of this message I have put the usual version information.
    
    Thanks for all your help and for your work on this wonderful product.
    
    
    > R.version
                   _
    platform       x86_64-w64-mingw32
    arch           x86_64
    os             mingw32
    system         x86_64, mingw32
    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
    
    ______________________________________________
    R-devel using r-project.org mailing list
    https://stat.ethz.ch/mailman/listinfo/r-devel
    



More information about the R-devel mailing list