add a missing section header table index conversion
[tangerine.git] / compiler / clib / include / sys / time.h
blobf64eb6800c0d343252e3c1847def0ac6473c0954
1 #ifndef _SYS_TIME_H_
2 #define _SYS_TIME_H_
4 /*
5 Copyright © 1995-2002, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: ANSI-C header file sys/time.h
9 Lang: english
12 #include <sys/types.h>
13 #include <time.h> /* XXX Probably not allowed */
15 #include <aros/_timeval.h> /* get struct timeval */
17 /* struct itimerval is used by the interval timers getitimer()/setitimer() */
18 struct itimerval
20 struct timeval it_interval; /* timer interval */
21 struct timeval it_value; /* current value */
24 /* Which interval timer */
25 #define ITIMER_REAL 0 /* Decrements in real time */
26 #define ITIMER_VIRTUAL 1 /* Decrements in task virtual time */
27 #define ITIMER_PROF 2 /* Decrements in task virtual/system time */
30 This structure describes a timezone. Note that most implementations of the
31 C library no longer use the timezone information passed to gettimeofday().
33 struct timezone
35 int tz_minuteswest; /* Minutes west of Greenwich. */
36 int tz_dsttime; /* Type of dst correction (see below). */
39 /* Daylight saving time styles. (tz_dsttime) */
40 #define DST_NONE 0 /* No special style. */
41 #define DST_USA 1 /* USA style. */
42 #define DST_AUST 2 /* Australian style. */
43 #define DST_WET 3 /* Western European style. */
44 #define DST_MET 4 /* Middle European style. */
45 #define DST_EET 5 /* Eastern European style. */
46 #define DST_CAN 6 /* Canadian style. */
47 #define DST_GB 7 /* Great British and Irish style. */
48 #define DST_RUM 8 /* Rumanian style. */
49 #define DST_TUR 9 /* Turkish style. */
50 #define DST_AUSTALT 10 /* Alternate Australian style. */
52 /* Convenience macros for working with timevals */
53 #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
54 #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
55 #define timercmp(tvp, uvp, cmp) \
56 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
57 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
58 ((tvp)->tv_sec cmp (uvp)->tv_sec))
59 #define timeradd(tvp, uvp, vvp) \
60 do { \
61 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
62 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
63 if ((vvp)->tv_usec >= 1000000) { \
64 (vvp)->tv_sec++; \
65 (vvp)->tv_usec -= 1000000; \
66 } \
67 } while (0)
68 #define timersub(tvp, uvp, vvp) \
69 do { \
70 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
71 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
72 if ((vvp)->tv_usec < 0) { \
73 (vvp)->tv_sec--; \
74 (vvp)->tv_usec += 1000000; \
75 } \
76 } while (0)
78 __BEGIN_DECLS
80 /* clib functions */
81 int getitimer(int which, struct itimerval *);
82 int setitimer(int which, const struct itimerval *, struct itimerval *);
83 int gettimeofday(struct timeval * tv, struct timezone * tz);
84 int settimeofday(const struct timeval * tv, const struct timezone * tz);
85 int utimes(const char *file, struct timeval tvp[2]);
87 __END_DECLS
90 SUSv2 says that select() is defined here. BSD however defines it in
91 unistd.h. So does AROS, as that makes more sense.
94 #endif /* _SYS_TIME_H_ */