]> code.delx.au - gnu-emacs/blobdiff - lisp/calendar/cal-dst.el
Make typing into incomplete C++ raw strings work, and make it work fast enough
[gnu-emacs] / lisp / calendar / cal-dst.el
index 0bcb61b4d42968f256c321be39be67d5dc90290f..84831e7beea1236660a2c2f4f74a97164aef2344 100644 (file)
@@ -1,13 +1,13 @@
 ;;; cal-dst.el --- calendar functions for daylight saving rules
 
-;; Copyright (C) 1993, 1994, 1995, 1996, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+;; Copyright (C) 1993-1996, 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Paul Eggert <eggert@twinsun.com>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
 ;; Maintainer: Glenn Morris <rgm@gnu.org>
 ;; Keywords: calendar
 ;; Human-Keywords: daylight saving time, calendar, diary, holidays
+;; Package: calendar
 
 ;; This file is part of GNU Emacs.
 
@@ -82,7 +82,7 @@ list and for correcting times of day in the solar and lunar calculations.
 
 For example, if daylight saving time ends on the last Sunday in October:
 
-      '(calendar-nth-named-day -1 0 10 year)
+      (calendar-nth-named-day -1 0 10 year)
 
 If the locale never uses daylight saving time, set this to nil."
   :type 'sexp
@@ -179,6 +179,7 @@ Return nil if no such transition can be found."
          (if (eq (car (current-time-zone probe)) hi-utc-diff)
              (setq hi probe)
            (setq lo probe)))
+       (setcdr hi (list (cdr hi)))
        hi))))
 
 (autoload 'calendar-persian-to-absolute "cal-persia")
@@ -212,12 +213,12 @@ The result has the proper form for `calendar-daylight-savings-starts'."
              rlist)
            ;; 01-01 and 07-01 for this year's Persian calendar.
            ;; FIXME what does the Persian calendar have to do with this?
-           (if (and (= m 3) (<= 20 d) (<= d 21))
-               '((calendar-gregorian-from-absolute
-                  (calendar-persian-to-absolute `(1 1 ,(- year 621))))))
-           (if (and (= m 9) (<= 22 d) (<= d 23))
-               '((calendar-gregorian-from-absolute
-                  (calendar-persian-to-absolute `(7 1 ,(- year 621))))))))
+           (and (= m 3) (memq d '(20 21))
+                '((calendar-gregorian-from-absolute
+                   (calendar-persian-to-absolute `(1 1 ,(- year 621))))))
+           (and (= m 9) (memq d '(22 23))
+                '((calendar-gregorian-from-absolute
+                   (calendar-persian-to-absolute `(7 1 ,(- year 621))))))))
          (prevday-sec (- -1 utc-diff)) ; last sec of previous local day
          (year (1+ y))
          new-rules)
@@ -347,8 +348,8 @@ DST-ZONE are equal, and all the DST-* integer variables are 0.
 Some operating systems cannot provide all this information to Emacs; in this
 case, `calendar-current-time-zone' returns a list containing nil for the data
 it can't find."
-  (unless calendar-current-time-zone-cache
-    (setq calendar-current-time-zone-cache (calendar-dst-find-data))))
+  (or calendar-current-time-zone-cache
+      (setq calendar-current-time-zone-cache (calendar-dst-find-data))))
 
 
 ;; Following options should be set based on conditions when the code
@@ -445,16 +446,12 @@ Fractional part of DATE is local standard time of day."
            (or (<= dst-starts date) (< date dst-ends))))))
 
 ;; used by calc, lunar, solar.
-(defun dst-adjust-time (date time &optional style)
+(defun dst-adjust-time (date time)
   "Adjust, to account for dst on DATE, decimal fraction standard TIME.
 Returns a list (date adj-time zone) where `date' and `adj-time' are the values
 adjusted for `zone'; here `date' is a list (month day year), `adj-time' is a
 decimal fraction time, and `zone' is a string.
 
-Optional parameter STYLE forces the result time to be standard time when its
-value is 'standard and daylight saving time (if available) when its value is
-'daylight.
-
 Conversion to daylight saving time is done according to
 `calendar-daylight-savings-starts', `calendar-daylight-savings-ends',
 `calendar-daylight-savings-starts-time',
@@ -473,5 +470,4 @@ Conversion to daylight saving time is done according to
 
 (provide 'cal-dst)
 
-;; arch-tag: a141d204-213c-4ca5-bdc6-f9df3aa92aad
 ;;; cal-dst.el ends here