Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gettimeofday(2) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

date(1)

settimeofday(2)

ctime(3C)

sde(5)



gettimeofday(2)                DG/UX R4.11MU05               gettimeofday(2)


NAME
       gettimeofday - get date and time

SYNOPSIS
       #include <sys/time.h>

       int gettimeofday (timevalue, timezone)
       struct timeval * timevalue;
       struct timezone * timezone;

   where:
       timevalue     Address of a structure that will be set to the current
                      time.

       timezone      NULL or address of a structure that will be set to the
                      current time zone.

DESCRIPTION
       Gettimeofday returns the system's notion of the current Greenwich
       time and the current time zone to the structures at the locations
       specified by timevalue and timezone.

       Two versions of gettimeofday are provided, to accommodate the
       differences in the System V and BSD implementations.  The BSD version
       of gettimeofday is selected unconditionally for 88K COFF-based
       software development environments (see sde(5)), and for other
       environments when BSD features are visible and either (1) the
       BSDTIMEOFDAYFLAVOR macro is defined, or (2) System V features are
       not visible.  The System V version is selected otherwise.  Note that
       DG/UX revisions prior to R4.10 provided only the BSD version.

       Both versions expect two arguments to be provided.  For the BSD
       version, both arguments are meaningful (as was true in all versions
       of DG/UX prior to R4.10).  For the System V version, the second
       argument is treated as NULL and should be coded as such.  In this
       case, a call might appear as follows:

            #include <sys/time.h>
            struct timeval *tp;
            result = gettimeofday(tp, (struct timezone *)0);

       If timezone is NULL, the current time zone is not returned.

       The time value returned is Greenwich time expressed in seconds and
       microseconds since midnight January 1, 1970.

       The local time zone is expressed in minutes of time westward from
       Greenwich (tzminuteswest), and a value (tzdsttime) that indicates
       the type of daylight savings time that applies locally during the
       appropriate part of the year.  The daylight savings time correction
       flag (tzdsttime) further indicates the type of daylight savings time
       correction to apply.  The accepted values are:

               DSTNONE        DST does not apply.
               DSTUSA         USA DST correction.
               DSTAUST        Australian DST correction.
               DSTWET         Western European DST correction.
               DSTMET         Middle European DST correction.
               DSTEET         Eastern European DST correction.

       The current local time may be computed using the current time zone by
       the following calculation:

       localusec = timevalue->tvusec;
       localsec = timevalue->tvsec - timezone->tzminuteswest * 60
                       + (isdst(timevalue,timezone) ? 60 * 60 : 0);

       where isdst(tv,tz) is some function that returns TRUE if daylight
       savings time is currently in effect.

ACCESS CONTROL
       None.

RETURN VALUE
       0      Completed successfully.

       -1     An error occurred.  errno is set to indicate the error.

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       EFAULT    An argument address referenced invalid memory.

SEE ALSO
       date(1), settimeofday(2), ctime(3C), sde(5).


Licensed material--property of copyright holder(s)

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