home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / calc.info-14 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  50KB  |  845 lines

  1. This is Info file calc.info, produced by Makeinfo-1.55 from the input
  2. file calc.texinfo.
  3.    This file documents Calc, the GNU Emacs calculator.
  4.    Copyright (C) 1990, 1991 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the section entitled "GNU General Public License" is included
  11. exactly as in the original, and provided that the entire resulting
  12. derived work is distributed under the terms of a permission notice
  13. identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the section entitled "GNU General Public License"
  17. may be included in a translation approved by the author instead of in
  18. the original English.
  19. File: calc.info,  Node: Time Zones,  Prev: Business Days,  Up: Date Arithmetic
  20. Time Zones
  21. ----------
  22. Time zones and daylight savings time are a complicated business.  The
  23. conversions to and from Julian and Unix-style dates automatically
  24. compute the correct time zone and daylight savings adjustment to use,
  25. provided they can figure out this information.  This section describes
  26. Calc's time zone adjustment algorithm in detail, in case you want to do
  27. conversions in different time zones or in case Calc's algorithms can't
  28. determine the right correction to use.
  29.    Adjustments for time zones and daylight savings time are done by `t
  30. U', `t J', `t N', and `t C', but not by any other commands.  In
  31. particular, `<may 1 1991> - <apr 1 1991>' evaluates to exactly 30 days
  32. even though there is a daylight-savings transition in between.  This is
  33. also true for Julian pure dates: `julian(<may 1 1991>) - julian(<apr 1
  34. 1991>)'.  But Julian and Unix date/times will adjust for daylight
  35. savings time: `julian(<12am may 1 1991>) - julian(<12am apr 1 1991>)'
  36. evaluates to `29.95834' (that's 29 days and 23 hours) because one hour
  37. was lost when daylight savings commenced on April 7, 1991.
  38.    In brief, the idiom `julian(DATE1) - julian(DATE2)' computes the
  39. actual number of 24-hour periods between two dates, whereas `DATE1 -
  40. DATE2' computes the number of calendar days between two dates without
  41. taking daylight savings into account.
  42.    The `calc-time-zone' [`tzone'] command converts the time zone
  43. specified by its numeric prefix argument into a number of seconds
  44. difference from Greenwich mean time (GMT).  If the argument is a
  45. number, the result is simply that value multiplied by 3600.  Typical
  46. arguments for North America are 5 (Eastern) or 8 (Pacific).  If
  47. Daylight Savings time is in effect, one hour should be subtracted from
  48. the normal difference.
  49.    If you give a prefix of plain `C-u', `calc-time-zone' (like other
  50. date arithmetic commands that include a time zone argument) takes the
  51. zone argument from the top of the stack.  (In the case of `t J' and `t
  52. U', the normal argument is then taken from the second-to-top stack
  53. position.)  This allows you to give a non-integer time zone adjustment.
  54. The time-zone argument can also be an HMS form, or it can be a
  55. variable which is a time zone name in upper- or lower-case.  For
  56. example `tzone(PST) = tzone(8)' and `tzone(pdt) = tzone(7)' (for
  57. Pacific standard and daylight savings times, respectively).
  58.    North American and European time zone names are defined as follows;
  59. note that for each time zone there is one name for standard time,
  60. another for daylight savings time, and a third for "generalized" time
  61. in which the daylight savings adjustment is computed from context.
  62.      YST  PST  MST  CST  EST  AST    NST    GMT   WET     MET    MEZ
  63.       9    8    7    6    5    4     3.5     0     -1      -2     -2
  64.      
  65.      YDT  PDT  MDT  CDT  EDT  ADT    NDT    BST  WETDST  METDST  MESZ
  66.       8    7    6    5    4    3     2.5     -1    -2      -3     -3
  67.      
  68.      YGT  PGT  MGT  CGT  EGT  AGT    NGT    BGT   WEGT    MEGT   MEGZ
  69.      9/8  8/7  7/6  6/5  5/4  4/3  3.5/2.5  0/-1 -1/-2   -2/-3  -2/-3
  70.    To define time zone names that do not appear in the above table, you
  71. must modify the Lisp variable `math-tzone-names'.  This is a list of
  72. lists describing the different time zone names; its structure is best
  73. explained by an example.  The three entries for Pacific Time look like
  74. this:
  75.      ( ( "PST" 8 0 )    ; Name as an upper-case string, then standard
  76.        ( "PDT" 8 -1 )   ; adjustment, then daylight savings adjustment.
  77.        ( "PGT" 8 "PST" "PDT" ) )   ; Generalized time zone.
  78.    With no arguments, `calc-time-zone' or `tzone()' obtains an argument
  79. from the Calc variable `TimeZone' if a value has been stored for that
  80. variable.  If not, Calc runs the Unix `date' command and looks for one
  81. of the above time zone names in the output; if this does not succeed,
  82. `tzone()' leaves itself unevaluated.  The time zone name in the `date'
  83. output may be followed by a signed adjustment, e.g., `GMT+5' or
  84. `GMT+0500' which specifies a number of hours and minutes to be added to
  85. the base time zone.  Calc stores the time zone it finds into `TimeZone'
  86. to speed later calls to `tzone()'.
  87.    The special time zone name `local' is equivalent to no argument,
  88. i.e., it uses the local time zone as obtained from the `date' command.
  89.    If the time zone name found is one of the standard or daylight
  90. savings zone names from the above table, and Calc's internal daylight
  91. savings algorithm says that time and zone are consistent (e.g., `PDT'
  92. accompanies a date that Calc's algorithm would also consider to be
  93. daylight savings, or `PST' accompanies a date that Calc would consider
  94. to be standard time), then Calc substitutes the corresponding
  95. generalized time zone (like `PGT').
  96.    If your system does not have a suitable `date' command, you may wish
  97. to put a `(setq var-TimeZone ...)' in your Emacs initialization file to
  98. set the time zone.  The easiest way to do this is to edit the
  99. `TimeZone' variable using Calc's `s T' command, then use the `s p'
  100. (`calc-permanent-variable') command to save the value of `TimeZone'
  101. permanently.
  102.    The `t J' and `t U' commands with no numeric prefix arguments do the
  103. same thing as `tzone()'.  If the current time zone is a generalized
  104. time zone, e.g., `EGT', Calc examines the date being converted to tell
  105. whether to use standard or daylight savings time.  But if the current
  106. time zone is explicit, e.g., `EST' or `EDT', then that adjustment is
  107. used exactly and Calc's daylight savings algorithm is not consulted.
  108.    Some places don't follow the usual rules for daylight savings time.
  109. The state of Arizona, for example, does not observe daylight savings
  110. time.  If you run Calc during the winter season in Arizona, the Unix
  111. `date' command will report `MST' time zone, which Calc will change to
  112. `MGT'.  If you then convert a time that lies in the summer months, Calc
  113. will apply an incorrect daylight savings time adjustment.  To avoid
  114. this, set your `TimeZone' variable explicitly to `MST' to force the use
  115. of standard, non-daylight-savings time.
  116.    By default Calc always considers daylight savings time to begin at 2
  117. a.m. on the first Sunday of April, and to end at 2 a.m. on the last
  118. Sunday of October.  This is the rule that has been in effect in North
  119. America since 1987.  If you are in a country that uses different rules
  120. for computing daylight savings time, you have two choices:  Write your
  121. own daylight savings hook, or control time zones explicitly by setting
  122. the `TimeZone' variable and/or always giving a time-zone argument for
  123. the conversion functions.
  124.    The Lisp variable `math-daylight-savings-hook' holds the name of a
  125. function that is used to compute the daylight savings adjustment for a
  126. given date.  The default is `math-std-daylight-savings', which computes
  127. an adjustment (either 0 or -1) using the North American rules given
  128. above.
  129.    The daylight savings hook function is called with four arguments:
  130. The date, as a floating-point number in standard Calc format; a
  131. six-element list of the date decomposed into year, month, day, hour,
  132. minute, and second, respective