3 * gettimeofday.c - get time of the day
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
10 #include <sys/param.h>
13 /****** net.lib/gettimeofday *********************************************
16 gettimeofday - get date and time
21 error = gettimeofday(tp, tzp)
23 int gettimeofday(struct timeval *, struct timezone *)
26 The system's notion of the current Greenwich time and the
27 current time zone is obtained with the gettimeofday() call.
28 The time is expressed in seconds and microseconds since
29 midnight (0 hour), January 1, 1970. The resolution of the
30 system clock is hardware dependent. If tzp is zero, the time
31 zone information will not be returned. Also, if your system
32 software is unable to provide time zone information, the
33 structure pointed by tzp will be filled with zeroes.
39 The structures pointed to by tp and tzp are defined in
43 long tv_sec; \* seconds since Jan. 1, 1970 *\
44 long tv_usec; \* and microseconds *\
48 int tz_minuteswest; \* of Greenwich *\
49 int tz_dsttime; \* type of dst correction to apply *\
52 The timezone structure indicates the local time zone (meas-
53 ured in minutes of time westward from Greenwich), and a flag
54 that, if nonzero, indicates that Daylight Saving time
55 applies locally during the appropriate part of the year.
58 Returns 0 when successful and -1 with specific error code in
59 errno in case of an error. No error codes are specified,
63 gettimeofday() uses GetSysTime() function of the timer.device,
64 which is new to V36 of the device.
66 Time zone information is taken from the locale.library, if it
67 is available (it is included in all Amiga systems from 2.1 and
68 up). Otherwise the environment variable "TZ" is consulted. If
69 it fails, the time zone is initialized to the GMT.
71 Global variable TimerBase _must_ be initialized before
72 gettimeofday() is called. This is normally done automatically
73 by the autoinit module (timerinit.c) included in the net.lib.
76 timer.device/GetSysTime()
77 *****************************************************************************
82 * See timerinit.c for comments on these
84 extern struct timezone __time_zone
;
85 extern long __local_to_GMT
;
88 gettimeofday(struct timeval
*tp
, struct timezone
*tzp
)
92 tp
->tv_sec
+= __local_to_GMT
;
96 * __time_zone is set up in the timerinit.c