Skip to content

Commit d270828

Browse files
committed
Fix one more bug in DST vs. normal timezone name determining in certain cases.
1 parent 6988dcc commit d270828

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

datetime.el

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ to this function.
962962
(num-years (length all-year-transitions))
963963
transitions)
964964
(when (>= year-offset num-years)
965+
;; Expand the transition array if it is too small. Don't expand by too few elements at a time.
965966
(setf (cadr timezone-data) (setq all-year-transitions (vconcat all-year-transitions (make-vector (max (1+ (- year-offset num-years)) (/ num-years 2) 10) nil)))))
966967
(let ((year (+ (nth 2 timezone-data) year-offset))
967968
(year-base (+ (nth 0 timezone-data) (* year-offset datetime--average-seconds-in-year)))
@@ -977,8 +978,14 @@ to this function.
977978
day-of-month -1))
978979
(offset-before (plist-get rule :before)))
979980
(unless transitions
980-
;; Preserve our DST "flag" across year boundary.
981-
(push (if (floatp (car (last (aref all-year-transitions (1- year-offset)))))
981+
;; Preserve our DST "flag" across year boundary. If there transitions for the previous year
982+
;; are not computed yet, look at the one before and so on, until we find something. With
983+
;; transitions coming from the rules it shouldn't matter: either every year ends in DST or
984+
;; every year ends in non-DST.
985+
(push (if (floatp (let ((k year-offset)
986+
historic-transitions)
987+
(while (null (setf historic-transitions (aref all-year-transitions (setf k (1- k))))))
988+
(car (last historic-transitions))))
982989
(float offset-before)
983990
offset-before)
984991
transitions))

0 commit comments

Comments
 (0)