current-time
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 high * 2**16 +
low.
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).
current-time-string
accepts an optional argument
time-value. If given, this specifies a time to format 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
.
current-time-zone
.
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 optional 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
and
from file-attributes
.
sit-for
, sleep-for
now let you specify the time period in
milliseconds as well as in seconds. The first argument gives the number
of seconds, as before, and the optional second argument gives additional
milliseconds. The time periods specified by these two arguments are
added together.
Not all systems support this; you get an error if you specify nonzero
milliseconds and it isn't supported.
sit-for
also accepts an optional third argument nodisp. If
this is non-nil
, sit-for
does not redisplay. It still
waits for the specified time or until input is available.
accept-process-output
now accepts a timeout specified by optional
second and third arguments. The second argument specifies the number of
seconds, while the third specifies the number of milliseconds. The time
periods specified by these two arguments are added together.
Not all systems support this; you get an error if you specify nonzero
milliseconds and it isn't supported.
The function returns nil
if the timeout expired before output
arrived, or non-nil
if it did get some output.
run-at-time
, like this:
(run-at-time time repeat function args...)Here, time is a string saying when to call the function. The argument function is the function to call later, and args are the arguments to give it when it is called. The argument repeat specifies how often to repeat the call. If repeat is
nil
, there are no repetitions; function is
called just once, at time. If repeat is an integer, it
specifies a repetition period measured in seconds.
Absolute times may be specified in a wide variety of formats; The form
`hour:min:sec timezone
month/day/year', where all fields are numbers, works;
the format that current-time-string
returns is also allowed.
To specify a relative time, use numbers followed by units.
For example:
To cancel the requested future action, pass the value that run-at-time
returned to the function cancel-timer
.