aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert2016-04-12 08:47:15 -0700
committerPaul Eggert2016-04-12 08:49:19 -0700
commitca509810014726cf6bee9f7e8f69bdeaf62dc146 (patch)
treebf9e81d82e77edebcd6addc1a9bc0392425b1bdd /doc
parentc23c965bb9d0a4bcc1b6158833ff99aa20fd53e9 (diff)
downloademacs-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.texi5
-rw-r--r--doc/lispref/os.texi67
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
637This specifies the current time zone and possibly also daylight 637This specifies the default time zone and possibly also daylight
638saving time information. On MS-DOS, if @env{TZ} is not set in the 638saving time information. @xref{Time Zone Rules,,, elisp, The GNU
639Emacs Lisp Reference Manual}. On MS-DOS, if @env{TZ} is not set in the
639environment when Emacs starts, Emacs defines a default value as 640environment when Emacs starts, Emacs defines a default value as
640appropriate for the country code returned by DOS@. On MS-Windows, Emacs 641appropriate for the country code returned by DOS@. On MS-Windows, Emacs
641does not use @env{TZ} at all. 642does 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
1263The argument @var{time}, if given, specifies a time to format, 1264The argument @var{time}, if given, specifies a time to format,
1264instead of the current time. The optional argument @var{zone} 1265instead of the current time. The optional argument @var{zone}
1265defaults to the current time zone rule. 1266defaults 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
1299or rounding errors occur. 1300or 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
1304This function returns a list describing the time zone that the user is 1305@cindex time zone rules
1305in.
1306
1307The 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
1310second element, @var{name}, is a string giving the name of the time
1311zone. Both elements change when daylight saving time begins or ends;
1312if the user has specified a time zone that does not use a seasonal time
1313adjustment, then the value is constant through time.
1314
1315If the operating system doesn't supply all the information necessary to
1316compute the value, the unknown elements of the list are @code{nil}.
1317
1318The argument @var{time}, if given, specifies a time value to
1319analyze instead of the current time. The optional argument @var{zone}
1320defaults to the current time zone rule.
1321@end defun
1322 1306
1323@vindex TZ, environment variable 1307@vindex TZ, environment variable
1324The default time zone is determined by the @env{TZ} environment 1308The 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,
1328which is a platform-dependent default time zone. 1312which is a platform-dependent default time zone.
1329 1313
1314The set of supported @env{TZ} strings is system-dependent. GNU and
1315many other systems support the tzdata database, e.g.,
1316@samp{"America/New_York"} specifies the time zone and daylight saving
1317time history for locations near New York City. GNU and most other
1318systems 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
1320York 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
1331Functions that convert to and from local time accept an optional 1324Functions 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
1337a string, the conversion uses the time zone rule equivalent to setting 1330a 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
1335This function returns a list describing the time zone that the user is
1336in.
1337
1338The 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
1341second element, @var{abbr}, is a string giving an abbreviation for the
1342time zone, e.g., @samp{"CST"} for China Standard Time or for
1343U.S. Central Standard Time. Both elements can change when daylight
1344saving time begins or ends; if the user has specified a time zone that
1345does not use a seasonal time adjustment, then the value is constant
1346through time.
1347
1348If the operating system doesn't supply all the information necessary to
1349compute the value, the unknown elements of the list are @code{nil}.
1350
1351The argument @var{time}, if given, specifies a time value to
1352analyze instead of the current time. The optional argument @var{zone}
1353defaults 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
1362This function converts a time value into calendrical information. If 1378This function converts a time value into calendrical information. If
1363you don't specify @var{time}, it decodes the current time, and similarly 1379you 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}.
1365value is a list of nine elements, as follows: 1381The 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
1409yourself before you call @code{encode-time}. 1425yourself before you call @code{encode-time}.
1410 1426
1411The optional argument @var{zone} defaults to the current time zone rule. 1427The optional argument @var{zone} defaults to the current time zone rule.
1428@xref{Time Zone Rules}.
1412In addition to the usual time zone rule values, it can also be a list 1429In 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
1414from @code{decode-time}), applied without any further alteration for 1431from @code{decode-time}), applied without any further alteration for
@@ -1452,8 +1469,8 @@ corresponding time value.
1452 1469
1453This function converts @var{time} (or the current time, if 1470This 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 1473defaults 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
1458substitute parts of the time. Here is a table of what the 1475substitute parts of the time. Here is a table of what the
1459@samp{%}-sequences mean: 1476@samp{%}-sequences mean: