forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parsing of timezones in timestamp strings (facebookincubator#9411)
Summary: Pull Request resolved: facebookincubator#9411 When parsing strings into timestamps, timezone information was being incorrectly handled. First, timezone offsets cannot be applied when parsing the timestamp string, as the parsing function does not have access to the user timezone - so one cannot simply assume GMT/UTC. . Therefore, this PR splits the parsing into two functions: * fromTimestampString(): parses the string and returns a timestamp independent of timezones. Fails if timezone information is found on the string. In practice, the function returns a unix epoch relative to GMT, but logically it should not be "bound" to a specific timezone yet. * fromTimestampWithTimezoneString(): parses the timestamp and timezone information, returning a pair with the independent values. The caller function is responsible for doing the right timezone adjustments. . The previous code used to simply adjust any timestamps parsed using the user supplied session timezone. This is correct if no timezones are supplied in the string, but not if there is a timezone in the string. . For example, "1970-01-01 00:00:00" is 0 if the user timezone is GMT, and 28800 if the user timezone is PST. But "1970-01-01 00:00:00Z" is always 0, independent of the user timezone ("Z" is one of synonyms of GMT/UTC). Reviewed By: kagamiori Differential Revision: D55906156 fbshipit-source-id: 6f566c5503edaf28507a3a18c007d483069aba23
- Loading branch information
1 parent
05cc947
commit b66f84c
Showing
9 changed files
with
261 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.