Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cfsettimeofday(2) — UTek W2.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

date(1)

ctime(3c)



GETTIMEOFDAY(2)         COMMAND REFERENCE         GETTIMEOFDAY(2)



NAME
     gettimeofday, settimeofday, cfsettimeofday - get/set date
     and time

SYNOPSIS
     #include <sys/time.h>

     gettimeofday(tp, tzp)
     struct timeval *tp;
     struct timezone *tzp;

     settimeofday(tp, tzp)
     struct timeval *tp;
     struct timezone *tzp;

     cfsettimeofday (cflag, tp, tzp)
     int cflag;
     struct timeval *tp;
     struct timezone *tzp;

DESCRIPTION
     Gettimeofday returns the system's notion of the current
     Greenwich time and the current time zone in the structures
     pointed to by tp and tzp. Settimeofday sets the time, using
     the contents of the structures.  Cfsettimeofday, in addition
     to setting the time, resets or computes the software
     correction factor for the system time-of-day clock via the
     cflag parameter.  Acceptable values for cflag follow:

     TVIGNORECORRECTIONFACTOR means do not change the
     correction factor.

     TVRESETCORRECTIONFACTOR means reset the correction factor
     to 1.0.

     TVCOMPUTECORRECTIONFACTOR means compute the software
     correction factor for the system time-of-day clock.

     Refer to date(1) for more details.

     Time returned is expressed relative in seconds and
     microseconds since midnight January 1, 1970.

     The structures pointed to by tp and tzp are defined in
     <sys/time.h> as:

     struct timeval {
          long tv_sec;        /* seconds since Jan. 1, 1970 */
          long tv_usec;       /* and microseconds */
     };

     struct timezone {



Printed 10/17/86                                                1





GETTIMEOFDAY(2)         COMMAND REFERENCE         GETTIMEOFDAY(2)



          int  tz_minuteswest;     /* of Greenwich */
          int  tz_dsttime;         /* type of dst correction to apply */
     };

     The timezone structure indicates the local time zone
     (measured in minutes of time westward from Greenwich), and a
     flag tz_dsttime, that, if nonzero, indicates that Daylight
     Saving time applies locally during the appropriate part of
     the year.

     Only the super-user can set the time of day.

DIAGNOSTICS
     If Gettimeofday, settimeofday, and cfsettimeofday fail, they
     can set the following errors in errno:

     [EFAULT]
         An argument address references invalid memory.

     In addition, settimeofday and cfsettimeofday can set the
     following errors:

     [EPERM]
         The caller is not the super-user.

     [EINVAL]
         Cflag is set to an invalid value.

RETURN VALUE
     Upon successful completion, a value of 0 is returned.
     Otherwise, a value of -1 is returned and errno is set to
     indicate the error.

CAVEATS
     Time is never correct enough to believe the microsecond
     values.  There should be a mechanism by which, at least,
     local clusters of systems might synchronize their clocks to
     millisecond granularity.

     If tp is NULL, the time system time will not be returned or
     set.  If tzp is NULL, the time zone information will not be
     returned or set.

SEE ALSO
     date(1), ctime(3c).










Printed 10/17/86                                                2





































































%%index%%
na:72,107;
sy:179,1581;
de:1760,1978;3882,489;
di:4371,865;
rv:5236,236;
ca:5472,432;
se:5904,107;
%%index%%000000000132

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