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