alsa.audio: limit the supported frequencies to common set
[AROS.git] / workbench / network / stacks / AROSTCP / netlib / gettimeofday.c
blob417c694d858a5242d03c927789e0df630e95b457
1 /* $Id$
3 * gettimeofday.c - get time of the day
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
7 * All rights reserved.
8 */
10 #include <sys/param.h>
11 #include <sys/time.h>
13 /****** net.lib/gettimeofday *********************************************
15 NAME
16 gettimeofday - get date and time
18 SYNOPSIS
19 #include <sys/time.h>
21 error = gettimeofday(tp, tzp)
23 int gettimeofday(struct timeval *, struct timezone *)
25 FUNCTION
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.
35 PORTABILITY
36 UNIX
38 INPUTS
39 The structures pointed to by tp and tzp are defined in
40 <sys/time.h> as:
42 struct timeval {
43 long tv_sec; \* seconds since Jan. 1, 1970 *\
44 long tv_usec; \* and microseconds *\
47 struct timezone {
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.
57 RESULT
58 Returns 0 when successful and -1 with specific error code in
59 errno in case of an error. No error codes are specified,
60 however.
62 NOTES
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.
75 SEE ALSO
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;
87 int
88 gettimeofday(struct timeval *tp, struct timezone *tzp)
90 if (tp) {
91 GetSysTime(tp);
92 tp->tv_sec += __local_to_GMT;
94 if (tzp) {
96 * __time_zone is set up in the timerinit.c
98 *tzp = __time_zone;
101 return 0;