]> pd.if.org Git - pdclib/blob - includes/time.h
remove() implemented directly without glue trampoline.
[pdclib] / includes / time.h
1 /* Date and time <time.h>
2
3    This file is part of the Public Domain C Library (PDCLib).
4    Permission is granted to use, modify, and / or redistribute at will.
5 */
6
7 #ifndef _PDCLIB_TIME_H
8 #define _PDCLIB_TIME_H _PDCLIB_TIME_H
9 #include "_PDCLIB_aux.h"
10 #include "_PDCLIB_int.h"
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 #ifndef _PDCLIB_SIZE_T_DEFINED
17 #define _PDCLIB_SIZE_T_DEFINED _PDCLIB_SIZE_T_DEFINED
18 typedef _PDCLIB_size_t size_t;
19 #endif
20
21 #ifndef _PDCLIB_NULL_DEFINED
22 #define _PDCLIB_NULL_DEFINED _PDCLIB_NULL_DEFINED
23 #define NULL _PDCLIB_NULL
24 #endif
25
26 typedef _PDCLIB_time_t  time_t;
27 typedef _PDCLIB_clock_t clock_t;
28
29 #define CLOCKS_PER_SEC _PDCLIB_CLOCKS_PER_SEC
30 #define TIME_UTC _PDCLIB_TIME_UTC
31
32 struct timespec
33 {
34     time_t tv_sec;
35     long tv_nsec;
36 };
37
38 struct tm
39 {
40     int tm_sec;   /* 0-60 */
41     int tm_min;   /* 0-59 */
42     int tm_hour;  /* 0-23 */
43     int tm_mday;  /* 1-31 */
44     int tm_mon;   /* 0-11 */
45     int tm_year;  /* years since 1900 */
46     int tm_wday;  /* 0-6 */
47     int tm_yday;  /* 0-365 */
48     int tm_isdst; /* >0 DST, 0 no DST, <0 information unavailable */
49 };
50
51 /* Returns the number of "clocks" in processor time since the invocation
52    of the program. Divide by CLOCKS_PER_SEC to get the value in seconds.
53    Returns -1 if the value cannot be represented in the return type or is
54    not available.
55 */
56 clock_t clock( void ) _PDCLIB_nothrow;
57
58 /* Returns the difference between two calendar times in seconds. */
59 double difftime( time_t time1, time_t time0 ) _PDCLIB_nothrow;
60
61 time_t mktime( struct tm * timeptr ) _PDCLIB_nothrow;
62
63 time_t time( time_t * timer ) _PDCLIB_nothrow;
64
65 int timespec_get( struct timespec * ts, int base ) _PDCLIB_nothrow;
66
67 char * asctime( const struct tm * timeptr ) _PDCLIB_nothrow;
68
69 char * ctime( const time_t * timer ) _PDCLIB_nothrow;
70
71 struct tm * gmtime( const time_t * timer ) _PDCLIB_nothrow;
72
73 struct tm * localtime( const time_t * timer ) _PDCLIB_nothrow;
74
75 size_t strftime( char * _PDCLIB_restrict s, size_t maxsize, const char * _PDCLIB_restrict format, const struct tm * _PDCLIB_restrict timeptr );
76
77 #ifdef __cplusplus
78 }
79 #endif
80
81 #endif