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

Wrong UTC Offset for "Etc/GMT-12" #69

Closed
mrj opened this Issue Jul 11, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@mrj

mrj commented Jul 11, 2017

require 'tzinfo'
TZInfo::Timezone.get('Etc/GMT-12').current_period

=> #<TZInfo::TimezonePeriod: nil,nil,#<TZInfo::TimezoneOffset: 43200,0,+12>>>

GMT-12 is a useful "Anywhere on Earth" zone.

@philr

This comment has been minimized.

Show comment
Hide comment
@philr

philr Jul 11, 2017

Member

An offset of +12 hours is the correct result for the Etc/GMT-12 zone.

TZInfo uses the data from the IANA Time Zone database. This defines the Etc/GMT[+-]n zones in a POSIX-compliant (but unexpected) manner. From the etcetera file in the database:

Be consistent with POSIX TZ settings in the Zone names even though this is the opposite of what many people expect. POSIX has positive signs west of Greenwich, but many people expect positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses the abbreviation "-04" and corresponds to 4 hours behind UT (i.e. west of Greenwich) even though many people would expect it to mean 4 hours ahead of UT (i.e. east of Greenwich).

Member

philr commented Jul 11, 2017

An offset of +12 hours is the correct result for the Etc/GMT-12 zone.

TZInfo uses the data from the IANA Time Zone database. This defines the Etc/GMT[+-]n zones in a POSIX-compliant (but unexpected) manner. From the etcetera file in the database:

Be consistent with POSIX TZ settings in the Zone names even though this is the opposite of what many people expect. POSIX has positive signs west of Greenwich, but many people expect positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses the abbreviation "-04" and corresponds to 4 hours behind UT (i.e. west of Greenwich) even though many people would expect it to mean 4 hours ahead of UT (i.e. east of Greenwich).

@philr philr added the invalid label Jul 11, 2017

@philr philr closed this Jul 11, 2017

@mrj

This comment has been minimized.

Show comment
Hide comment
@mrj

mrj Jul 11, 2017

OK. I've now got to work out why this zone is coming up in ActiveSupport::TimeZone as GMT+12, adjacent to Auckland, rather than at the top before American Samoa.

EDIT: Ah, I use GMT+12 for Anywhere on Earth. Thanks.

mrj commented Jul 11, 2017

OK. I've now got to work out why this zone is coming up in ActiveSupport::TimeZone as GMT+12, adjacent to Auckland, rather than at the top before American Samoa.

EDIT: Ah, I use GMT+12 for Anywhere on Earth. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment