
GETTIMEOFDAY(2)            UNIX Programmer's Manual            GETTIMEOFDAY(2)

NNAAMMEE
     ggeettttiimmeeooffddaayy, sseettttiimmeeooffddaayy - get/set date and time

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssyyss//ttiimmee..hh>>

     _i_n_t
     ggeettttiimmeeooffddaayy(_s_t_r_u_c_t _t_i_m_e_v_a_l _*_t_p, _s_t_r_u_c_t _t_i_m_e_z_o_n_e _*_t_z_p)

     _i_n_t
     sseettttiimmeeooffddaayy(_s_t_r_u_c_t _t_i_m_e_v_a_l _*_t_p, _s_t_r_u_c_t _t_i_m_e_z_o_n_e _*_t_z_p)

DDEESSCCRRIIPPTTIIOONN
     NNoottee:: ttiimmeezzoonnee iiss nnoo lloonnggeerr uusseedd;; tthhiiss iinnffoorrmmaattiioonn iiss kkeepptt oouuttssiiddee tthhee
     kkeerrnneell..   The system's notion of the current Greenwich time and the cur-
     rent time zone is obtained with the ggeettttiimmeeooffddaayy() call, and set with the
     sseettttiimmeeooffddaayy() call.  The time is expressed in seconds and microseconds
     since midnight (0 hour), January 1, 1970.  The resolution of the system
     clock is hardware dependent, and the time may be updated continuously or
     in ``ticks.''  If _t_p or _t_z_p is NULL, the associated time information will
     not be returned or set.

     The structures pointed to by _t_p and _t_z_p are defined in <_s_y_s_/_t_i_m_e_._h> as:

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

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

     The _t_i_m_e_z_o_n_e structure indicates the local time zone (measured in minutes
     of time westward from Greenwich), and a flag that, if nonzero, indicates
     that Daylight Saving time applies locally during the appropriate part of
     the year.

     Only the super-user may set the time of day or time zone.

RREETTUURRNN
     A 0 return value indicates that the call succeeded.  A -1 return value
     indicates an error occurred, and in this case an error code is stored in-
     to the global variable _e_r_r_n_o.

EERRRROORRSS
     The following error codes may be set in _e_r_r_n_o:

     [EFAULT]  An argument address referenced invalid memory.

     [EPERM]   A user other than the super-user attempted to set the time.

SSEEEE AALLSSOO
     date(1),  adjtime(2),  ctime(3),  timed(8)

HHIISSTTOORRYY
     The ggeettttiimmeeooffddaayy function call appeared in 4.2BSD.

4th Berkeley Distribution       March 10, 1991                               1



