Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGZILLA #16621] strptime(, tz=x) returns inconsistent gmtoff and tzone properties #6008

Open
MichaelChirico opened this issue May 18, 2020 · 0 comments

Comments

@MichaelChirico
Copy link
Owner

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

  • attr(*, "tzone")= chr [1:3] "Pacific/Honolulu" "HST" "HDT"

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"


METADATA

  • Bug author - Alex Bertram
  • Creation time - 2015-12-04 12:49:25 UTC
  • Bugzilla link
  • Status - UNCONFIRMED
  • Alias - None
  • Component - Accuracy
  • Version - R 3.2.2
  • Hardware - x86_64/x64/amd64 (64-bit) Linux
  • Importance - P5 enhancement
  • Assignee - R-core
  • URL -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant