1 /**
2  * D header file for C99.
3  *
4  * Copyright: Public Domain
5  * License:   Public Domain
6  * Authors:   Sean Kelly
7  * Standards: ISO/IEC 9899:1999 (E)
8  */
9 module tango.stdc.time;
10 
11 private import tango.stdc.config;
12 private import tango.stdc.stddef;
13 
14 extern (C):
15 
16 version( Win32 )
17 {
18     struct tm
19     {
20         int     tm_sec;     // seconds after the minute - [0, 60]
21         int     tm_min;     // minutes after the hour - [0, 59]
22         int     tm_hour;    // hours since midnight - [0, 23]
23         int     tm_mday;    // day of the month - [1, 31]
24         int     tm_mon;     // months since January - [0, 11]
25         int     tm_year;    // years since 1900
26         int     tm_wday;    // days since Sunday - [0, 6]
27         int     tm_yday;    // days since January 1 - [0, 365]
28         int     tm_isdst;   // Daylight Saving Time flag
29     }
30 }
31 else
32 {
33     struct tm
34     {
35         int     tm_sec;     // seconds after the minute [0-60]
36         int     tm_min;     // minutes after the hour [0-59]
37         int     tm_hour;    // hours since midnight [0-23]
38         int     tm_mday;    // day of the month [1-31]
39         int     tm_mon;     // months since January [0-11]
40         int     tm_year;    // years since 1900
41         int     tm_wday;    // days since Sunday [0-6]
42         int     tm_yday;    // days since January 1 [0-365]
43         int     tm_isdst;   // Daylight Savings Time flag
44         c_long  tm_gmtoff;  // offset from CUT in seconds
45         char*   tm_zone;    // timezone abbreviation
46     }
47 }
48 
49 alias c_long time_t;
50 alias c_long clock_t;
51 
52 version( Win32 )
53 {
54     enum:clock_t {CLOCKS_PER_SEC = 1000}
55 }
56 else version(OSX)
57 {
58     enum:clock_t {CLOCKS_PER_SEC = 100}
59 }
60 else version( FreeBSD )
61 {
62     enum:clock_t {CLOCKS_PER_SEC = 128}
63 }
64 else version( solaris )
65 {
66     enum:clock_t {CLOCKS_PER_SEC = 1000000}
67 }
68 else
69 {
70     enum:clock_t {CLOCKS_PER_SEC = 1000000}
71 }
72 
73 clock_t clock();
74 double  difftime(time_t time1, time_t time0);
75 time_t  mktime(tm* timeptr);
76 time_t  time(time_t* timer);
77 char*   asctime(in tm* timeptr);
78 char*   ctime(in time_t* timer);
79 tm*     gmtime(in time_t* timer);
80 tm*     localtime(in time_t* timer);
81 size_t  strftime(char* s, size_t maxsize, in char* format, in tm* timeptr);
82 size_t  wcsftime(wchar_t* s, size_t maxsize, in wchar_t* format, in tm* timeptr);
83 
84 version( Win32 )
85 {
86     void  tzset();
87     void  _tzset();
88     char* _strdate(char* s);
89     char* _strtime(char* s);
90 
91     wchar_t* _wasctime(tm*);
92     wchar_t* _wctime(time_t*);
93     wchar_t* _wstrdate(wchar_t*);
94     wchar_t* _wstrtime(wchar_t*);
95 }
96 else version(OSX)
97 {
98     void tzset();
99 }
100 else version( linux )
101 {
102     void tzset();
103 }
104 else version( FreeBSD )
105 {
106     void tzset();
107 }
108 else version( solaris )
109 {
110     void tzset();
111 }