File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -857,13 +857,18 @@ object DateTimeUtils {
857857 var guess = tz.getRawOffset
858858 // the actual offset should be calculated based on milliseconds in UTC
859859 var actual = tz.getOffset(millisLocal - guess)
860- // At the start of DST, the local time is forwarded by an hour, so it's OK to get the
861- // local time bigger than current one after an round trip (local -> UTC -> local).
862- // At the end of DST, the local time is backwarded by an hour, actual offset will be
863- // less than guess, we should decrease the guess and try again.
864- while (actual < guess) {
860+ if (actual != guess) {
861+ // try with the result as guess
865862 guess = actual
866863 actual = tz.getOffset(millisLocal - guess)
864+ // At the start of DST, the local time is forwarded by an hour, so it's OK to get the
865+ // local time bigger than current one after an round trip (local -> UTC -> local).
866+ // At the end of DST, the local time is backwarded by an hour, actual offset will be
867+ // less than guess, we should decrease the guess and try again.
868+ while (actual < guess) {
869+ guess = actual
870+ actual = tz.getOffset(millisLocal - guess)
871+ }
867872 }
868873 guess
869874 }
You can’t perform that action at this time.
0 commit comments