31.11 Daylight Saving Time
Emacs understands the difference between standard time and daylight saving time—the times given for sunrise, sunset, solstices, equinoxes, and the phases of the moon take that into account. The rules for daylight saving time vary from place to place and have also varied historically from year to year. To do the job properly, Emacs needs to know which rules to use.
Some operating systems keep track of the rules that apply to the place where you are; on these systems, Emacs gets the information it needs from the system automatically. If some or all of this information is missing, Emacs fills in the gaps with the rules currently used in Cambridge, Massachusetts. If the resulting rules are not what you want, you can tell Emacs the rules to use by setting certain variables: calendar-daylight-savings-starts
and calendar-daylight-savings-ends
.
These values should be Lisp expressions that refer to the variable year
, and evaluate to the Gregorian date on which daylight saving time starts or (respectively) ends, in the form of a list (month day year)
. The values should be nil
if your area does not use daylight saving time.
Emacs uses these expressions to determine the starting date of daylight saving time for the holiday list and for correcting times of day in the solar and lunar calculations.
The values for Cambridge, Massachusetts are as follows:
(calendar-nth-named-day 2 0 3 year)
(calendar-nth-named-day 1 0 11 year)
That is, the second 0th day (Sunday) of the third month (March) in the year specified by year
, and the first Sunday of the eleventh month (November) of that year. If daylight saving time were changed to start on October 1, you would set calendar-daylight-savings-starts
to this:
(list 10 1 year)
If there is no daylight saving time at your location, or if you want all times in standard time, set calendar-daylight-savings-starts
and calendar-daylight-savings-ends
to nil
.
The variable calendar-daylight-time-offset
specifies the difference between daylight saving time and standard time, measured in minutes. The value for Cambridge, Massachusetts is 60.
Finally, the two variables calendar-daylight-savings-starts-time
and calendar-daylight-savings-ends-time
specify the number of minutes after midnight local time when the transition to and from daylight saving time should occur. For Cambridge, Massachusetts both variables’ values are 120.