1

Resolved

Date-time conversion on time zones may have a fault.

description

Ah, date time handling, words fail me... Not much impact, but still.
Some unit tests on date times may have been working by luck. stumbled across it when testing the move to using R.NET for most operations.
in R creating a posixct with the time zone Australia/Sydney, but internally (if R.NET is turned off) the C code in check_POSIXct_has_simple_timezone does not detect the time zone attribute. The same getAttrib operation however works with class name retrieval. Maybe I need to use make_char_sexp_one instead of mkChar, to retrieve the attribute properly?

Repro:
library(rClrDevtools)
library(testthat)
cpDebugBins()
library(rClr)
testDir <- system.file('tests', package='rClr') 
stopifnot(file.exists(testDir))
source(file.path(testDir, 'load_libs.r'))
source(file.path(testDir, 'datetime-functions.r'))
testRtoClrAestTz('1980-01-01')

comments

jperraud wrote Dec 18, 2014 at 4:40 AM

As of release 0.7-2, throws an System.NotSupportedException. I think this is what I want. Double check, then close issue if correct behavior.

juanalumni wrote Jan 20, 2015 at 3:07 PM

This test fails me also on W7 64 bits, with R 3.1.2
library(rClr)
Loading the dynamic library for Microsoft .NET runtime...
Loaded Common Language Runtime version 4.0.30319.18444

library(testthat)
test_package('rClr')
rClr essentials : ...............................................................................................................................................................................................
Date and times : ..............................................12.....................................................................................
  1. Failure(@C:/R/R-3.1.2/library/rClr/tests/datetime-functions.r#59): Date and Time objects are marshalled correctly
    From CLR : 2000-12-31 13:00:00 UTC;2001-01-01 13:00:00 UTC;2001-01-02 13:00:00 UTC;2001-01-03 13:00:00 UTC;2001-01-04 13:00:00 UTC not equal to Expected : 2001-01-01 03:00:00 UTC;2001-01-02 03:00:00 UTC;2001-01-03 03:00:00 UTC;2001-01-04 03:00:00 UTC;2001-01-05 03:00:00 UTC
    Mean absolute difference: 50400
  2. Failure(@C:/R/R-3.1.2/library/rClr/tests/datetime-functions.r#59): Date and Time objects are marshalled correctly
    From CLR : 2000-12-31 13:00:00 UTC;2000-12-31 13:00:01 UTC;2000-12-31 13:00:02 UTC;2000-12-31 13:00:03 UTC;2000-12-31 13:00:04 UTC;2000-12-31 13:00:05 UTC;2000-12-31 13:00:06 UTC;2000-12-31 13:00:07 UTC;2000-12-31 13:00:08 UTC;2000-12-31 13:00:09 UTC;2000-12-31 13:00:10 UTC;2000-12-31 13:00:11 UTC;2000-12-31 13:00:12 UTC;2000-12-31 13:00:13 UTC;2000-12-31 13:00:14 UTC;2000-12-31 13:00:15 UTC;2000-12-31 13:00:16 UTC;2000-12-31 13:00:17 UTC;2000-12-31 13:00:18 UTC;2000-12-31 13:00:19 UTC;2000-12-31 13:00:20 UTC;2000-12-31 13:00:21 UTC;2000-12-31 13:00:22 UTC;2000-12-31 13:00:23 UTC;2000-12-31 13:00:24 UTC;2000-12-31 13:00:25 UTC;2000-12-31 13:00:26 UTC;2000-12-31 13:00:27 UTC;2000-12-31 13:00:28 UTC;2000-12-31 13:00:29 UTC;2000-12-31 13:00:30 UTC;2000-12-31 13:00:31 UTC;2000-12-31 13:00:32 UTC;2000-12-31 13:00:33 UTC;2000-12-31 13:00:34 UTC;2000-12-31 13:00:35 UTC;2000-12-31 13:00:36 UTC;2000-12-31 13:00:37 UTC;2000-12-31 13:00:38 UTC;2000-12-31 13:00:39 UTC;2000-12-31 13:00:40 UTC;2000-12-31 13:00:41 UTC not equal to Expected : 2001-01-01 03:00:00 UTC;2001-01-01 03:00:01 UTC;2001-01-01 03:00:02 UTC;2001-01-01 03:00:03 UTC;2001-01-01 03:00:04 UTC;2001-01-01 03:00:05 UTC;2001-01-01 03:00:06 UTC;2001-01-01 03:00:07 UTC;2001-01-01 03:00:08 UTC;2001-01-01 03:00:09 UTC;2001-01-01 03:00:10 UTC;2001-01-01 03:00:11 UTC;2001-01-01 03:00:12 UTC;2001-01-01 03:00:13 UTC;2001-01-01 03:00:14 UTC;2001-01-01 03:00:15 UTC;2001-01-01 03:00:16 UTC;2001-01-01 03:00:17 UTC;2001-01-01 03:00:18 UTC;2001-01-01 03:00:19 UTC;2001-01-01 03:00:20 UTC;2001-01-01 03:00:21 UTC;2001-01-01 03:00:22 UTC;2001-01-01 03:00:23 UTC;2001-01-01 03:00:24 UTC;2001-01-01 03:00:25 UTC;2001-01-01 03:00:26 UTC;2001-01-01 03:00:27 UTC;2001-01-01 03:00:28 UTC;2001-01-01 03:00:29 UTC;2001-01-01 03:00:30 UTC;2001-01-01 03:00:31 UTC;2001-01-01 03:00:32 UTC;2001-01-01 03:00:33 UTC;2001-01-01 03:00:34 UTC;2001-01-01 03:00:35 UTC;2001-01-01 03:00:36 UTC;2001-01-01 03:00:37 UTC;2001-01-01 03:00:38 UTC;2001-01-01 03:00:39 UTC;2001-01-01 03:00:40 UTC;2001-01-01 03:00:41 UTC
    Mean absolute difference: 50400

juanalumni wrote Jan 20, 2015 at 3:09 PM

I'm on GMT -3 BTW