b231942d9fa42660626ecbb3210196b76a8df858
[reactos.git] / posix / include / time.h
1 /* $Id: time.h,v 1.2 2002/02/20 09:17:55 hyperion Exp $
2 */
3 /*
4 * time.h
5 *
6 * time types. Conforming to the Single UNIX(r) Specification Version 2,
7 * System Interface & Headers Issue 5
8 *
9 * This file is part of the ReactOS Operating System.
10 *
11 * Contributors:
12 * Created by KJK::Hyperion <noog@libero.it>
13 *
14 * THIS SOFTWARE IS NOT COPYRIGHTED
15 *
16 * This source code is offered for use in the public domain. You may
17 * use, modify or distribute it freely.
18 *
19 * This code is distributed in the hope that it will be useful but
20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21 * DISCLAMED. This includes but is not limited to warranties of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 *
24 */
25 #ifndef __TIME_H_INCLUDED__
26 #define __TIME_H_INCLUDED__
27
28 /* INCLUDES */
29 #include <signal.h>
30 #include <sys/types.h>
31
32 /* OBJECTS */
33 //extern static int getdate_err; /* FIXME */
34 extern int daylight;
35 extern long int timezone;
36 extern char *tzname[];
37
38 /* TYPES */
39 /* pre-declaration of signal.h types to suppress warnings caused by circular
40 dependencies */
41 struct sigevent;
42
43 struct tm
44 {
45 int tm_sec; /* seconds [0,61] */
46 int tm_min; /* minutes [0,59] */
47 int tm_hour; /* hour [0,23] */
48 int tm_mday; /* day of month [1,31] */
49 int tm_mon; /* month of year [0,11] */
50 int tm_year; /* years since 1900 */
51 int tm_wday; /* day of week [0,6] (Sunday = 0) */
52 int tm_yday; /* day of year [0,365] */
53 int tm_isdst; /* daylight savings flag */
54 };
55
56 struct timespec
57 {
58 time_t tv_sec; /* seconds */
59 long tv_nsec; /* nanoseconds */
60 };
61
62 struct itimerspec
63 {
64 struct timespec it_interval; /* timer period */
65 struct timespec it_value; /* timer expiration */
66 };
67
68 /* CONSTANTS */
69 /* FIXME: all the constants are wrong */
70 /* Number of clock ticks per second returned by the times() function (LEGACY). */
71 #define CLK_TCK (1)
72 /* A number used to convert the value returned by the clock() function into
73 seconds. */
74 #define CLOCKS_PER_SEC (1)
75 /* The identifier of the systemwide realtime clock. */
76 #define CLOCK_REALTIME (0)
77 /* Flag indicating time is absolute with respect to the clock associated with a
78 timer. */
79 #define TIMER_ABSTIME (1)
80
81 /* PROTOTYPES */
82 char *asctime(const struct tm *);
83 char *asctime_r(const struct tm *, char *);
84 clock_t clock(void);
85 int clock_getres(clockid_t, struct timespec *);
86 int clock_gettime(clockid_t, struct timespec *);
87 int clock_settime(clockid_t, const struct timespec *);
88 char *ctime(const time_t *);
89 char *ctime_r(const time_t *, char *);
90 double difftime(time_t, time_t);
91 struct tm *getdate(const char *);
92 struct tm *gmtime(const time_t *);
93 struct tm *gmtime_r(const time_t *, struct tm *);
94 struct tm *localtime(const time_t *);
95 struct tm *localtime_r(const time_t *, struct tm *);
96 time_t mktime(struct tm *);
97 int nanosleep(const struct timespec *, struct timespec *);
98 size_t strftime(char *, size_t, const char *, const struct tm *);
99 char *strptime(const char *, const char *, struct tm *);
100 time_t time(time_t *);
101 int timer_create(clockid_t, struct sigevent *, timer_t *);
102 int timer_delete(timer_t);
103 int timer_gettime(timer_t, struct itimerspec *);
104 int timer_getoverrun(timer_t);
105 int timer_settime(timer_t, int, const struct itimerspec *,
106 struct itimerspec *);
107 void tzset(void);
108
109 /* MACROS */
110
111 #endif /* __TIME_H_INCLUDED__ */ /* replace with the appropriate tag */
112
113 /* EOF */
114