[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

39.5 Daylight Savings Time

Emacs understands the difference between standard time and daylight savings time--the times given for sunrise, sunset, solstices, equinoxes, and the phases of the moon take that into account. The rules for daylight savings 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, which is the center of GNU's world.

If the default choice of rules is not appropriate for your location, you can tell Emacs the rules to use by setting the variables calendar-daylight-savings-starts and calendar-daylight-savings-ends. Their values should be Lisp expressions that refer to the variable year, and evaluate to the Gregorian date on which daylight savings 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 savings time.

Emacs uses these expressions to determine the start and end dates of daylight savings time as holidays and for correcting times of day in the solar and lunar calculations.

The values for Cambridge, Massachusetts are as follows:

 
(calendar-nth-named-day 1 0 4 year)
(calendar-nth-named-day -1 0 10 year)

i.e., the first 0th day (Sunday) of the fourth month (April) in the year specified by year, and the last Sunday of the tenth month (October) of that year. If daylight savings time were changed to start on October 1, you would set calendar-daylight-savings-starts to this:

 
(list 10 1 year)

For a more complex example, suppose daylight savings time begins on the first of Nisan on the Hebrew calendar. You should set calendar-daylight-savings-starts to this value:

 
(calendar-gregorian-from-absolute
  (calendar-absolute-from-hebrew
    (list 1 1 (+ year 3760))))

because Nisan is the first month in the Hebrew calendar and the Hebrew year differs from the Gregorian year by 3760 at Nisan.

If there is no daylight savings 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 savings time and standard time, measured in minutes. The value for Cambridge is 60.

The variable calendar-daylight-savings-starts-time and the variable calendar-daylight-savings-ends-time specify the number of minutes after midnight local time when the transition to and from daylight savings time should occur. For Cambridge, both variables' values are 120.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on May 2, 2002 using texi2html