https://github.com/apache/spark
Revision 41efd2091781b31118c6d37be59e4f0f4ae2bf66 authored by Davies Liu on 19 June 2016, 07:34:52 UTC, committed by Davies Liu on 19 June 2016, 07:35:17 UTC
## What changes were proposed in this pull request?

Internally, we use Int to represent a date (the days since 1970-01-01), when we convert that into unix timestamp (milli-seconds since epoch in UTC), we get the offset of a timezone using local millis (the milli-seconds since 1970-01-01 in a timezone), but TimeZone.getOffset() expect unix timestamp, the result could be off by one hour (in Daylight Saving Time (DST) or not).

This PR change to use best effort approximate of posix timestamp to lookup the offset. In the event of changing of DST, Some time is not defined (for example, 2016-03-13 02:00:00 PST), or could lead to multiple valid result in UTC (for example, 2016-11-06 01:00:00), this best effort approximate should be enough in practice.

## How was this patch tested?

Added regression tests.

Author: Davies Liu <davies@databricks.com>

Closes #13652 from davies/fix_timezone.

(cherry picked from commit 001a58960311b07fe80e2f01e473f4987948d06e)
Signed-off-by: Davies Liu <davies.liu@gmail.com>
1 parent 3f1d730
History
Tip revision: 41efd2091781b31118c6d37be59e4f0f4ae2bf66 authored by Davies Liu on 19 June 2016, 07:34:52 UTC
[SPARK-15613] [SQL] Fix incorrect days to millis conversion due to Daylight Saving Time
Tip revision: 41efd20

README.md

back to top