8480d68d63c0206e639ec0de885a0aae883d689e
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / include_exp / time.h
1 /*
2  * Acess2 C Library
3  * - By John Hodge (thePowersGang)
4  *
5  * time.h
6  * - C99 Time Functions
7  */
8 #ifndef _TIME_H_
9 #define _TIME_H_
10
11 #include <sys/types.h>  // time_t
12 #include <stddef.h>     // size_t
13
14 struct tm
15 {
16          int    tm_sec; // 0-60
17          int    tm_min; // 0-59
18          int    tm_hour;
19          int    tm_mday;
20          int    tm_mon;
21          int    tm_year;        // 1900 based
22          int    tm_wday;
23          int    tm_yday;
24          int    tm_isdst;
25 };
26
27 #define CLOCKS_PER_SEC  1000
28
29 typedef signed long long        clock_t;
30
31 //! Processor time used since invocation
32 extern clock_t  clock(void);
33
34 //! Difference between two times in seconds
35 extern double difftime(time_t time1, time_t time0);
36
37 //! Convert a local time into the format returned by \a time
38 //! \note Also updates tm_wday and tm_yday to the correct values
39 extern time_t   mktime(struct tm *timeptr);
40
41 //! Get the current calendar time
42 //! \note -1 is returned if the calendar time is not avaliable
43 extern time_t   time(time_t *t);
44
45 //
46 // Time conversions
47 //
48 //! Convert the time structure into a string of form 'Sun Sep 16 01:03:52 1973\n\0'
49 extern char *asctime(const struct tm *timeptr);
50
51 //! asctime(localtime(timer))
52 extern char *ctime(const time_t *timer);
53
54 //! Convert \a timter into UTC
55 extern struct tm *gmtime(const time_t *timer);
56
57 extern struct tm *localtime(const time_t *timer);
58
59 extern size_t strftime(char*restrict s, size_t maxsize, const char*restrict format, const struct tm*restrict timeptr);
60
61 #include <libposix_time.h>
62
63 #endif
64

UCC git Repository :: git.ucc.asn.au