xref: /haiku/headers/posix/time.h (revision 23d36867f63af34f65b35f1eb42a269bf36a0555)
1 #ifndef _TIME_H_
2 #define _TIME_H_
3 /*
4 ** Distributed under the terms of the OpenBeOS License.
5 */
6 
7 
8 #include <sys/types.h>
9 
10 
11 typedef long clock_t;
12 typedef long time_t;
13 
14 #define CLOCKS_PER_SEC	1000
15 #define CLK_TCK			CLOCKS_PER_SEC
16 
17 #define MAX_TIMESTR		70
18 	/* maximum length of a string returned by asctime(), and ctime() */
19 
20 struct tm {
21 	int	tm_sec;
22 	int	tm_min;
23 	int	tm_hour;
24 	int	tm_mday;	/* day of month (1 to 31) */
25 	int	tm_mon;		/* months since January (0 to 11) */
26 	int	tm_year;	/* years since 1900 */
27 	int	tm_wday;	/* days since Sunday (0 to 6, Sunday = 0, ...) */
28 	int	tm_yday;	/* days since January 1 (0 to 365) */
29 	int	tm_isdst;	/* daylight savings time (0 == no, >0 == yes, <0 == has to be calculated */
30 	int tm_gmtoff;	/* timezone offset to GMT */
31 	char *tm_zone;	/* timezone name */
32 };
33 
34 
35 /* special timezone support */
36 extern char *tzname[2];
37 extern int 	daylight;
38 extern long	timezone;
39 
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 extern clock_t		clock(void);
46 extern double		difftime(time_t time1, time_t time2);
47 extern time_t		mktime(struct tm *tm);
48 extern time_t		time(time_t *timer);
49 extern char			*asctime(const struct tm *tm);
50 extern char			*asctime_r(const struct tm *timep, char *buffer);
51 extern char			*ctime(const time_t *timer);
52 extern char			*ctime_r(const time_t *timer, char *buffer);
53 extern struct tm	*gmtime(const time_t *timer);
54 extern struct tm	*gmtime_r(const time_t *timer, struct tm *tm);
55 extern struct tm	*localtime(const time_t *timer);
56 extern struct tm	*localtime_r(const time_t *timer, struct tm *tm);
57 extern size_t		strftime(char *buffer, size_t maxSize, const char *format,
58 						const struct tm *tm);
59 
60 /* special timezone support */
61 extern void tzset(void);
62 extern int	stime(const time_t *t);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif	/* _TIME_H_ */
69