GNU Info

Info Node: (elisp)Time of Day

(elisp)Time of Day


Next: Time Conversion Prev: User Identification Up: System Interface
Enter node , (file) or (file)node

Time of Day
===========

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

 - Function: current-time-string &optional time-value
     This function returns the current time and date as a human-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 some day 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' (Note:
     File Attributes).

          (current-time-string)
               => "Wed Oct 14 22:21:05 1987"

 - Function: current-time
     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
     (local time), which is HIGH * 2**16 + LOW.

     The third element, MICROSEC, gives the microseconds since the
     start of the current second (or 0 for systems that return time with
     the resolution of only one second).

     The first two elements can be compared with file time values such
     as you get with the function `file-attributes'.  Note: File
     Attributes.

 - Function: current-time-zone &optional time-value
     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' (Note: File Attributes).

 - Function: float-time &optional time-value
     This function returns the current time as a floating-point number
     of seconds since the epoch.  The argument TIME-VALUE, if given,
     specifies a time to convert instead of the current time.  The
     argument should have the same form as for `current-time-string'
     (see above), and it also accepts the output of `current-time' and
     `file-attributes'.

     _Warning_: Since the result is floating point, it may not be
     exact.  Do not use this function if precise time stamps are
     required.


automatically generated by info2www version 1.2.2.9