diff options
| author | Paul Eggert | 2016-04-12 08:47:15 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-04-12 08:49:19 -0700 |
| commit | ca509810014726cf6bee9f7e8f69bdeaf62dc146 (patch) | |
| tree | bf9e81d82e77edebcd6addc1a9bc0392425b1bdd /doc | |
| parent | c23c965bb9d0a4bcc1b6158833ff99aa20fd53e9 (diff) | |
| download | emacs-ca509810014726cf6bee9f7e8f69bdeaf62dc146.tar.gz emacs-ca509810014726cf6bee9f7e8f69bdeaf62dc146.zip | |
Improve time zone documentation
* doc/lispref/os.texi (Time Zone Rules):
New section, mostly with material moved here from other sections.
* doc/emacs/cmdargs.texi (General Variables):
* doc/lispref/os.texi (Time Conversion, Time Parsing):
Xref new section.
* etc/NEWS, etc/PROBLEMS:
* lisp/org/org.el (org-timestamp-format):
* src/editfns.c (Fformat_time_string, Fdecode_time)
(Fencode_time, Fcurrent_time_string, Fcurrent_time_zone)
(Fset_time_zone_rule):
When documenting time zone rule strings, mention the TZ
environment variable in preference to mentioning the
sort-of-internal function set-time-zone-rule.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/cmdargs.texi | 5 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 67 |
2 files changed, 45 insertions, 27 deletions
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index a842cb84abd..f0f686f855c 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi | |||
| @@ -634,8 +634,9 @@ to put temporary files (@pxref{Backup}). Emacs tries to use | |||
| 634 | @env{TMP}, then @env{TEMP}, and finally @file{c:/temp}. | 634 | @env{TMP}, then @env{TEMP}, and finally @file{c:/temp}. |
| 635 | @item TZ | 635 | @item TZ |
| 636 | @vindex TZ, environment variable | 636 | @vindex TZ, environment variable |
| 637 | This specifies the current time zone and possibly also daylight | 637 | This specifies the default time zone and possibly also daylight |
| 638 | saving time information. On MS-DOS, if @env{TZ} is not set in the | 638 | saving time information. @xref{Time Zone Rules,,, elisp, The GNU |
| 639 | Emacs Lisp Reference Manual}. On MS-DOS, if @env{TZ} is not set in the | ||
| 639 | environment when Emacs starts, Emacs defines a default value as | 640 | environment when Emacs starts, Emacs defines a default value as |
| 640 | appropriate for the country code returned by DOS@. On MS-Windows, Emacs | 641 | appropriate for the country code returned by DOS@. On MS-Windows, Emacs |
| 641 | does not use @env{TZ} at all. | 642 | does not use @env{TZ} at all. |
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index 88397452689..5f189b984a3 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -19,6 +19,7 @@ terminal and the screen. | |||
| 19 | * System Environment:: Distinguish the name and kind of system. | 19 | * System Environment:: Distinguish the name and kind of system. |
| 20 | * User Identification:: Finding the name and user id of the user. | 20 | * User Identification:: Finding the name and user id of the user. |
| 21 | * Time of Day:: Getting the current time. | 21 | * Time of Day:: Getting the current time. |
| 22 | * Time Zone Rules:: Rules for time zones and daylight saving time. | ||
| 22 | * Time Conversion:: Converting a time from numeric form to | 23 | * Time Conversion:: Converting a time from numeric form to |
| 23 | calendrical data and vice versa. | 24 | calendrical data and vice versa. |
| 24 | * Time Parsing:: Converting a time from numeric form to text | 25 | * Time Parsing:: Converting a time from numeric form to text |
| @@ -1262,7 +1263,7 @@ information may some day be added at the end. | |||
| 1262 | 1263 | ||
| 1263 | The argument @var{time}, if given, specifies a time to format, | 1264 | The argument @var{time}, if given, specifies a time to format, |
| 1264 | instead of the current time. The optional argument @var{zone} | 1265 | instead of the current time. The optional argument @var{zone} |
| 1265 | defaults to the current time zone rule. | 1266 | defaults to the current time zone rule. @xref{Time Zone Rules}. |
| 1266 | 1267 | ||
| 1267 | @example | 1268 | @example |
| 1268 | @group | 1269 | @group |
| @@ -1299,26 +1300,9 @@ For example, if @var{time} is a number, @code{(time-to-seconds | |||
| 1299 | or rounding errors occur. | 1300 | or rounding errors occur. |
| 1300 | @end defun | 1301 | @end defun |
| 1301 | 1302 | ||
| 1302 | @defun current-time-zone &optional time zone | 1303 | @node Time Zone Rules |
| 1303 | @cindex time zone, current | 1304 | @section Time Zone Rules |
| 1304 | This function returns a list describing the time zone that the user is | 1305 | @cindex time zone rules |
| 1305 | in. | ||
| 1306 | |||
| 1307 | The value has the form @code{(@var{offset} @var{name})}. Here | ||
| 1308 | @var{offset} is an integer giving the number of seconds ahead of Universal Time | ||
| 1309 | (east of Greenwich). A negative value means west of Greenwich. The | ||
| 1310 | second element, @var{name}, is a string giving the name of the time | ||
| 1311 | zone. Both elements change when daylight saving time begins or ends; | ||
| 1312 | if the user has specified a time zone that does not use a seasonal time | ||
| 1313 | adjustment, then the value is constant through time. | ||
| 1314 | |||
| 1315 | If the operating system doesn't supply all the information necessary to | ||
| 1316 | compute the value, the unknown elements of the list are @code{nil}. | ||
| 1317 | |||
| 1318 | The argument @var{time}, if given, specifies a time value to | ||
| 1319 | analyze instead of the current time. The optional argument @var{zone} | ||
| 1320 | defaults to the current time zone rule. | ||
| 1321 | @end defun | ||
| 1322 | 1306 | ||
| 1323 | @vindex TZ, environment variable | 1307 | @vindex TZ, environment variable |
| 1324 | The default time zone is determined by the @env{TZ} environment | 1308 | The default time zone is determined by the @env{TZ} environment |
| @@ -1327,6 +1311,15 @@ to default to Universal Time with @code{(setenv "TZ" "UTC0")}. If | |||
| 1327 | @env{TZ} is not in the environment, Emacs uses system wall clock time, | 1311 | @env{TZ} is not in the environment, Emacs uses system wall clock time, |
| 1328 | which is a platform-dependent default time zone. | 1312 | which is a platform-dependent default time zone. |
| 1329 | 1313 | ||
| 1314 | The set of supported @env{TZ} strings is system-dependent. GNU and | ||
| 1315 | many other systems support the tzdata database, e.g., | ||
| 1316 | @samp{"America/New_York"} specifies the time zone and daylight saving | ||
| 1317 | time history for locations near New York City. GNU and most other | ||
| 1318 | systems support POSIX-style @env{TZ} strings, e.g., | ||
| 1319 | @samp{"EST+5EDT,M4.1.0/2,M10.5.0/2"} specifies the rules used in New | ||
| 1320 | York from 1987 through 2006. All systems support the string | ||
| 1321 | @samp{"UTC0"} meaning Universal Time. | ||
| 1322 | |||
| 1330 | @cindex time zone rule | 1323 | @cindex time zone rule |
| 1331 | Functions that convert to and from local time accept an optional | 1324 | Functions that convert to and from local time accept an optional |
| 1332 | @dfn{time zone rule} argument, which specifies the conversion's time | 1325 | @dfn{time zone rule} argument, which specifies the conversion's time |
| @@ -1337,6 +1330,29 @@ If it is @code{t}, the conversion uses Universal Time. If it is | |||
| 1337 | a string, the conversion uses the time zone rule equivalent to setting | 1330 | a string, the conversion uses the time zone rule equivalent to setting |
| 1338 | @env{TZ} to that string. | 1331 | @env{TZ} to that string. |
| 1339 | 1332 | ||
| 1333 | @defun current-time-zone &optional time zone | ||
| 1334 | @cindex time zone, current | ||
| 1335 | This function returns a list describing the time zone that the user is | ||
| 1336 | in. | ||
| 1337 | |||
| 1338 | The value has the form @code{(@var{offset} @var{abbr})}. Here | ||
| 1339 | @var{offset} is an integer giving the number of seconds ahead of Universal Time | ||
| 1340 | (east of Greenwich). A negative value means west of Greenwich. The | ||
| 1341 | second element, @var{abbr}, is a string giving an abbreviation for the | ||
| 1342 | time zone, e.g., @samp{"CST"} for China Standard Time or for | ||
| 1343 | U.S. Central Standard Time. Both elements can change when daylight | ||
| 1344 | saving time begins or ends; if the user has specified a time zone that | ||
| 1345 | does not use a seasonal time adjustment, then the value is constant | ||
| 1346 | through time. | ||
| 1347 | |||
| 1348 | If the operating system doesn't supply all the information necessary to | ||
| 1349 | compute the value, the unknown elements of the list are @code{nil}. | ||
| 1350 | |||
| 1351 | The argument @var{time}, if given, specifies a time value to | ||
| 1352 | analyze instead of the current time. The optional argument @var{zone} | ||
| 1353 | defaults to the current time zone rule. | ||
| 1354 | @end defun | ||
| 1355 | |||
| 1340 | @node Time Conversion | 1356 | @node Time Conversion |
| 1341 | @section Time Conversion | 1357 | @section Time Conversion |
| 1342 | @cindex calendrical information | 1358 | @cindex calendrical information |
| @@ -1361,8 +1377,8 @@ as traditional Gregorian years do; for example, the year number | |||
| 1361 | @defun decode-time &optional time zone | 1377 | @defun decode-time &optional time zone |
| 1362 | This function converts a time value into calendrical information. If | 1378 | This function converts a time value into calendrical information. If |
| 1363 | you don't specify @var{time}, it decodes the current time, and similarly | 1379 | you don't specify @var{time}, it decodes the current time, and similarly |
| 1364 | @var{zone} defaults to the current time zone rule. The return | 1380 | @var{zone} defaults to the current time zone rule. @xref{Time Zone Rules}. |
| 1365 | value is a list of nine elements, as follows: | 1381 | The return value is a list of nine elements, as follows: |
| 1366 | 1382 | ||
| 1367 | @example | 1383 | @example |
| 1368 | (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{utcoff}) | 1384 | (@var{seconds} @var{minutes} @var{hour} @var{day} @var{month} @var{year} @var{dow} @var{dst} @var{utcoff}) |
| @@ -1409,6 +1425,7 @@ to stand for years above 1900, or years above 2000, you must alter them | |||
| 1409 | yourself before you call @code{encode-time}. | 1425 | yourself before you call @code{encode-time}. |
| 1410 | 1426 | ||
| 1411 | The optional argument @var{zone} defaults to the current time zone rule. | 1427 | The optional argument @var{zone} defaults to the current time zone rule. |
| 1428 | @xref{Time Zone Rules}. | ||
| 1412 | In addition to the usual time zone rule values, it can also be a list | 1429 | In addition to the usual time zone rule values, it can also be a list |
| 1413 | (as you would get from @code{current-time-zone}) or an integer (as | 1430 | (as you would get from @code{current-time-zone}) or an integer (as |
| 1414 | from @code{decode-time}), applied without any further alteration for | 1431 | from @code{decode-time}), applied without any further alteration for |
| @@ -1452,8 +1469,8 @@ corresponding time value. | |||
| 1452 | 1469 | ||
| 1453 | This function converts @var{time} (or the current time, if | 1470 | This function converts @var{time} (or the current time, if |
| 1454 | @var{time} is omitted) to a string according to | 1471 | @var{time} is omitted) to a string according to |
| 1455 | @var{format-string}. The conversion uses the time zone rule @var{zone} | 1472 | @var{format-string}. The conversion uses the time zone rule @var{zone}, which |
| 1456 | (or the current time zone rule, if omitted). The argument | 1473 | defaults to the current time zone rule. @xref{Time Zone Rules}. The argument |
| 1457 | @var{format-string} may contain @samp{%}-sequences which say to | 1474 | @var{format-string} may contain @samp{%}-sequences which say to |
| 1458 | substitute parts of the time. Here is a table of what the | 1475 | substitute parts of the time. Here is a table of what the |
| 1459 | @samp{%}-sequences mean: | 1476 | @samp{%}-sequences mean: |