From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/time-of-day.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 devdocs/elisp/time-of-day.html (limited to 'devdocs/elisp/time-of-day.html') diff --git a/devdocs/elisp/time-of-day.html b/devdocs/elisp/time-of-day.html new file mode 100644 index 00000000..636ae8fe --- /dev/null +++ b/devdocs/elisp/time-of-day.html @@ -0,0 +1,24 @@ +

Time of Day

This section explains how to determine the current time and time zone.

Many functions like current-time and file-attributes return Lisp timestamp values that count seconds, and that can represent absolute time by counting seconds since the epoch of 1970-01-01 00:00:00 UTC.

Although traditionally Lisp timestamps were integer pairs, their form has evolved and programs ordinarily should not depend on the current default form. If your program needs a particular timestamp form, you can use the time-convert function to convert it to the needed form. See Time Conversion.

There are currently three forms of Lisp timestamps, each of which represents a number of seconds:

Function arguments, e.g., the time argument to current-time-string, accept a more-general time value format, which can be a Lisp timestamp, nil for the current time, a single floating-point number for seconds, or a list (high low micro) or (high +low) that is a truncated list timestamp with missing elements taken to be zero.

Time values can be converted to and from calendrical and other forms. Some of these conversions rely on operating system functions that limit the range of possible time values, and signal an error such as ‘"Specified time is not representable"’ if the limits are exceeded. For instance, a system may not support years before 1970, or years before 1901, or years far in the future. You can convert a time value into a human-readable string using format-time-string, into a Lisp timestamp using time-convert, and into other forms using decode-time and float-time. These functions are described in the following sections.

Function: current-time-string &optional time zone +
+

This function returns the current time and date as a human-readable string. The format does not vary for the initial part of the string, which contains the day of week, month, day of month, and time of day in that order: the number of characters used for these fields is always the same, although (unless you require English weekday or month abbreviations regardless of locale) it is typically more convenient to use format-time-string than to extract fields from the output of current-time-string, as the year might not have exactly four digits, and additional information may some day be added at the end.

The argument time, if given, specifies a time to format, instead of the current time. The optional argument zone defaults to the current time zone rule. See Time Zone Rules. The operating system limits the range of time and zone values.

(current-time-string)
+     ⇒ "Fri Nov  1 15:59:49 2019"
+
+
+
Function: current-time +

This function returns the current time as a Lisp timestamp. Although the timestamp takes the form (high low +micro pico) in the current Emacs release, this is planned to change in a future Emacs version. You can use the time-convert function to convert a timestamp to some other form. See Time Conversion.

+
Function: float-time &optional time +
+

This function returns the current time as a floating-point number of seconds since the epoch. The optional argument time, if given, specifies a time to convert instead of the current time.

Warning: Since the result is floating point, it may not be exact. Do not use this function if precise time stamps are required. For example, on typical systems (float-time '(1 . 10)) displays as ‘0.1’ but is slightly greater than 1/10.

time-to-seconds is an alias for this function.

+
+
+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Time-of-Day.html +

+
-- cgit v1.2.3