Next: Time Conversion, Previous: User Identification, Up: System Interface [Contents][Index]
This section explains how to determine the current time and the time zone.
This function returns the current time and date as a humanly-readable
string. The format of the string is unvarying; the number of characters
used for each part is always the same, so you can reliably use
substring
to extract pieces of it. It is wise to count the
characters from the beginning of the string rather than from the end, as
additional information may be added at the end.
The argument time-value, if given, specifies a time to format
instead of the current time. The argument should be a list whose first
two elements are integers. Thus, you can use times obtained from
current-time
(see below) and from file-attributes
(see File Attributes).
(current-time-string) ⇒ "Fri May 6 21:35:58 2005"
This function returns the system’s time value as a list of three
integers: (high low microsec)
. The integers
high and low combine to give the number of seconds since
0:00 January 1, 1970, which is
The third element, microsec, gives the microseconds since the start of the current second or 0 for systems that return time only on the resolution of a second.
The first two elements can be compared with file time values such as you
get with the function file-attributes
. See File Attributes.
This function returns a list describing the time zone that the user is in.
The value has the form (offset name)
. Here
offset is an integer giving the number of seconds ahead of UTC
(east of Greenwich). A negative value means west of Greenwich. The
second element, name is a string giving the name of the time
zone. Both elements change when daylight savings time begins or ends;
if the user has specified a time zone that does not use a seasonal time
adjustment, then the value is constant through time.
If the operating system doesn’t supply all the information necessary to
compute the value, both elements of the list are nil
.
The argument time-value, if given, specifies a time to analyze
instead of the current time. The argument should be a cons cell
containing two integers, or a list whose first two elements are
integers. Thus, you can use times obtained from current-time
(see above) and from file-attributes
(see File Attributes).
Next: Time Conversion, Previous: User Identification, Up: System Interface [Contents][Index]