aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-11-01 16:13:31 -0700
committerPaul Eggert2019-11-01 16:13:50 -0700
commit9b1c00b3ca1a1f841cdcfd880536b0dc7669738a (patch)
treefff3a2c8d45fe2f092c7cbcd41cafc294fcebac6
parenta8b87446656af0395864b7aaa697a4e04bcc1218 (diff)
downloademacs-9b1c00b3ca1a1f841cdcfd880536b0dc7669738a.tar.gz
emacs-9b1c00b3ca1a1f841cdcfd880536b0dc7669738a.zip
Document limits on some time-conversion functions
* doc/lispref/os.texi (Time of Day, Time Zone Rules) (Time Conversion, Time Parsing, Time Calculations): Document functions that limit the range of time values due to OS limits (Bug#37974).
-rw-r--r--doc/lispref/os.texi32
1 files changed, 22 insertions, 10 deletions
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index d8d0ad7206d..d3ddee251b7 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1307,7 +1307,14 @@ format, which can be a Lisp timestamp, @code{nil} for the current
1307time, a single floating-point number for seconds, or a list 1307time, a single floating-point number for seconds, or a list
1308@code{(@var{high} @var{low} @var{micro})} or @code{(@var{high} 1308@code{(@var{high} @var{low} @var{micro})} or @code{(@var{high}
1309@var{low})} that is a truncated list timestamp with missing elements 1309@var{low})} that is a truncated list timestamp with missing elements
1310taken to be zero. You can convert a time value into 1310taken to be zero.
1311
1312Time values can be converted to and from calendrical and other forms.
1313Some of these conversions rely on operating system functions that
1314limit the range of possible time values, and signal an error if the
1315limits are exceeded. For instance, a system may not support years
1316before 1970, or years before 1901, or years far in the future.
1317You can convert a time value into
1311a human-readable string using @code{format-time-string}, into a Lisp 1318a human-readable string using @code{format-time-string}, into a Lisp
1312timestamp using @code{time-convert}, and into other forms using 1319timestamp using @code{time-convert}, and into other forms using
1313@code{decode-time} and @code{float-time}. These functions are 1320@code{decode-time} and @code{float-time}. These functions are
@@ -1328,11 +1335,12 @@ information may some day be added at the end.
1328The argument @var{time}, if given, specifies a time to format, 1335The argument @var{time}, if given, specifies a time to format,
1329instead of the current time. The optional argument @var{zone} 1336instead of the current time. The optional argument @var{zone}
1330defaults to the current time zone rule. @xref{Time Zone Rules}. 1337defaults to the current time zone rule. @xref{Time Zone Rules}.
1338The operating system limits the range of time and zone values.
1331 1339
1332@example 1340@example
1333@group 1341@group
1334(current-time-string) 1342(current-time-string)
1335 @result{} "Wed Oct 14 22:21:05 1987" 1343 @result{} "Fri Nov @ 1 15:59:49 2019"
1336@end group 1344@end group
1337@end example 1345@end example
1338@end defun 1346@end defun
@@ -1416,6 +1424,7 @@ compute the value, the unknown elements of the list are @code{nil}.
1416The argument @var{time}, if given, specifies a time value to 1424The argument @var{time}, if given, specifies a time value to
1417analyze instead of the current time. The optional argument @var{zone} 1425analyze instead of the current time. The optional argument @var{zone}
1418defaults to the current time zone rule. 1426defaults to the current time zone rule.
1427The operating system limits the range of time and zone values.
1419@end defun 1428@end defun
1420 1429
1421@node Time Conversion 1430@node Time Conversion
@@ -1498,6 +1507,8 @@ Although @code{(time-convert nil nil)} is equivalent to
1498This function converts a time value into calendrical information. If 1507This function converts a time value into calendrical information. If
1499you don't specify @var{time}, it decodes the current time, and similarly 1508you don't specify @var{time}, it decodes the current time, and similarly
1500@var{zone} defaults to the current time zone rule. @xref{Time Zone Rules}. 1509@var{zone} defaults to the current time zone rule. @xref{Time Zone Rules}.
1510The operating system limits the range of time and zone values.
1511
1501The @var{form} argument controls the form of the returned 1512The @var{form} argument controls the form of the returned
1502@var{seconds} element, as described below. 1513@var{seconds} element, as described below.
1503The return value is a list of nine elements, as follows: 1514The return value is a list of nine elements, as follows:
@@ -1631,6 +1642,7 @@ convention, @var{zone} defaults to the current time zone rule
1631Year numbers less than 100 are not treated specially. If you want them 1642Year numbers less than 100 are not treated specially. If you want them
1632to stand for years above 1900, or years above 2000, you must alter them 1643to stand for years above 1900, or years above 2000, you must alter them
1633yourself before you call @code{encode-time}. 1644yourself before you call @code{encode-time}.
1645The operating system limits the range of time values.
1634 1646
1635The @code{encode-time} function acts as a rough inverse to 1647The @code{encode-time} function acts as a rough inverse to
1636@code{decode-time}. For example, you can pass the output of 1648@code{decode-time}. For example, you can pass the output of
@@ -1643,11 +1655,6 @@ the latter to the former as follows:
1643You can perform simple date arithmetic by using out-of-range values for 1655You can perform simple date arithmetic by using out-of-range values for
1644@var{seconds}, @var{minutes}, @var{hour}, @var{day}, and @var{month}; 1656@var{seconds}, @var{minutes}, @var{hour}, @var{day}, and @var{month};
1645for example, day 0 means the day preceding the given month. 1657for example, day 0 means the day preceding the given month.
1646
1647The operating system puts limits on the range of possible time values;
1648if the limits are exceeded while encoding the time, an error results.
1649For instance, years before 1970 do not work on some systems;
1650on others, years as early as 1901 do work.
1651@end defun 1658@end defun
1652 1659
1653@node Time Parsing 1660@node Time Parsing
@@ -1666,6 +1673,7 @@ corresponding Lisp timestamp. The argument @var{string} should represent
1666a date-time, and should be in one of the forms recognized by 1673a date-time, and should be in one of the forms recognized by
1667@code{parse-time-string} (see below). This function assumes the GMT 1674@code{parse-time-string} (see below). This function assumes the GMT
1668timezone if @var{string} lacks an explicit timezone information. 1675timezone if @var{string} lacks an explicit timezone information.
1676The operating system limits the range of time values.
1669@end defun 1677@end defun
1670 1678
1671@defun parse-time-string string 1679@defun parse-time-string string
@@ -1847,10 +1855,12 @@ behavior, as future versions of Emacs may recognize new
1847This function uses the C library function @code{strftime} 1855This function uses the C library function @code{strftime}
1848(@pxref{Formatting Calendar Time,,, libc, The GNU C Library Reference 1856(@pxref{Formatting Calendar Time,,, libc, The GNU C Library Reference
1849Manual}) to do most of the work. In order to communicate with that 1857Manual}) to do most of the work. In order to communicate with that
1850function, it first encodes its argument using the coding system 1858function, it first converts @var{time} and @var{zone} to internal form;
1859the operating system limits the range of time and zone values.
1860This function also encodes @var{format-string} using the coding system
1851specified by @code{locale-coding-system} (@pxref{Locales}); after 1861specified by @code{locale-coding-system} (@pxref{Locales}); after
1852@code{strftime} returns the resulting string, 1862@code{strftime} returns the resulting string,
1853@code{format-time-string} decodes the string using that same coding 1863this function decodes the string using that same coding
1854system. 1864system.
1855@end defun 1865@end defun
1856 1866
@@ -1990,10 +2000,12 @@ Here is how to add a number of seconds to a time value:
1990@defun time-to-days time-value 2000@defun time-to-days time-value
1991This function returns the number of days between the beginning of year 2001This function returns the number of days between the beginning of year
19921 and @var{time-value}. 20021 and @var{time-value}.
2003The operating system limits the range of time values.
1993@end defun 2004@end defun
1994 2005
1995@defun time-to-day-in-year time-value 2006@defun time-to-day-in-year time-value
1996This returns the day number within the year corresponding to @var{time-value}. 2007This returns the day number within the year corresponding to @var{time-value}.
2008The operating system limits the range of time values.
1997@end defun 2009@end defun
1998 2010
1999@defun date-leap-year-p year 2011@defun date-leap-year-p year
@@ -2002,7 +2014,7 @@ This function returns @code{t} if @var{year} is a leap year.
2002 2014
2003@defun date-days-in-month year month 2015@defun date-days-in-month year month
2004Return the number of days in @var{month} in @var{year}. For instance, 2016Return the number of days in @var{month} in @var{year}. For instance,
2005there's 29 days in February 2004. 2017February 2020 has 29 days.
2006@end defun 2018@end defun
2007 2019
2008@defun date-ordinal-to-time year ordinal 2020@defun date-ordinal-to-time year ordinal