You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the format provided to strptime() includes an offset (%z) element AND the tz argument, the resulting POSIXlt value has a gmtoff that conflicts with the tzone attribute.
For example:
t <- strptime('24/Aug/2014:17:57:26 +0200', '%d/%b/%Y:%H:%M:%S %z',
+ tz = 'Pacific/Honolulu')
t
[1] "2014-08-24 05:57:26"
str(unclass(t))
List of 11
$ sec : num 26
$ min : int 57
$ hour : int 5
$ mday : int 24
$ mon : int 7
$ year : int 114
$ wday : int 0
$ yday : int 235
$ isdst : int 0
$ zone : chr ""
$ gmtoff: int 7200
The time fields seem to be correct, at 17:57 in the GMT+2 time zone: it's indeed 5:57 in Hawaii, but the gmt offset 7200 refers to the GMT+2 timezone, not Hawaii, whose offset is -10 hours, or -36000 seconds.
Do I misunderstand the purpose of the gmtoff value or is something that should be fixed? If so, will happily submit patch.
str(R.Version())
List of 14
$ platform : chr "x86_64-pc-linux-gnu"
$ arch : chr "x86_64"
$ os : chr "linux-gnu"
$ system : chr "x86_64, linux-gnu"
$ status : chr ""
$ major : chr "3"
$ minor : chr "2.0"
$ year : chr "2015"
$ month : chr "04"
$ day : chr "16"
$ svn rev : chr "68180"
$ language : chr "R"
$ version.string: chr "R version 3.2.0 (2015-04-16)"
$ nickname : chr "Full of Ingredients"
When the format provided to strptime() includes an offset (%z) element AND the tz argument, the resulting POSIXlt value has a gmtoff that conflicts with the tzone attribute.
For example:
+ tz = 'Pacific/Honolulu')
[1] "2014-08-24 05:57:26"
List of 11
$ sec : num 26
$ min : int 57
$ hour : int 5
$ mday : int 24
$ mon : int 7
$ year : int 114
$ wday : int 0
$ yday : int 235
$ isdst : int 0
$ zone : chr ""
$ gmtoff: int 7200
The time fields seem to be correct, at 17:57 in the GMT+2 time zone: it's indeed 5:57 in Hawaii, but the gmt offset 7200 refers to the GMT+2 timezone, not Hawaii, whose offset is -10 hours, or -36000 seconds.
Do I misunderstand the purpose of the gmtoff value or is something that should be fixed? If so, will happily submit patch.
List of 14
$ platform : chr "x86_64-pc-linux-gnu"
$ arch : chr "x86_64"
$ os : chr "linux-gnu"
$ system : chr "x86_64, linux-gnu"
$ status : chr ""
$ major : chr "3"
$ minor : chr "2.0"
$ year : chr "2015"
$ month : chr "04"
$ day : chr "16"
$ svn rev : chr "68180"
$ language : chr "R"
$ version.string: chr "R version 3.2.0 (2015-04-16)"
$ nickname : chr "Full of Ingredients"
METADATA
The text was updated successfully, but these errors were encountered: