Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gettimeofday(3c) — NEWS-os 5.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

adjtime(2)

ctime(3C)

timezone(4)



gettimeofday(3C)        LIBRARY FUNCTIONS        gettimeofday(3C)



NAME
     gettimeofday, settimeofday - get or set the date and time

SYNOPSIS
     #include <sys/time.h>
     int gettimeofday (struct timeval *tp);
     int settimeofday (struct timeval *tp);

DESCRIPTION
     gettimeofday gets and settimeofday sets the system's  notion
     of  the  current  time.   The  current  time is expressed in
     elapsed seconds and microseconds since 00:00 Universal Coor-
     dinated Time, January 1, 1970.  The resolution of the system
     clock is hardware dependent; the time may  be  updated  con-
     tinuously, or in clock ticks.  tp points to a timeval struc-
     ture, which includes the following members:
          long    tvsec;    /* seconds since Jan. 1, 1970 */
          long    tvusec;   /* and microseconds */
     If tp is a NULL pointer, the current time information is not
     returned  or  set.   The  TZ environment variable holds time
     zone information.  See  timezone(4).   Only  the  privileged
     user may set the time of day.

RETURN
     A -1 return value indicates an error occurred and errno  has
     been set.

ERRORS
     The following error codes may be set in errno:

     EINVAL              tp specifies an invalid time.

     EPERM               A user other than  the  privileged  user
                         attempted to set the time or time zone.

SEE ALSO
     adjtime(2), ctime(3C), timezone(4)

NOTES
     The implementation of settimeofday ignores the tvusec field
     of  tp.   If  the  time needs to be set with better than one
     second accuracy, call settimeofday for the seconds and  then
     adjtime for finer accuracy.












                                                                1



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026