comparison druntime/import/core/stdc/time.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * D header file for C99.
3 *
4 * Copyright: Copyright Sean Kelly 2005 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Sean Kelly
7 * Standards: ISO/IEC 9899:1999 (E)
8 *
9 * Copyright Sean Kelly 2005 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE_1_0.txt or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
13 */
14 module core.stdc.time;
15
16 private import core.stdc.config;
17 private import core.stdc.stddef; // for size_t
18
19 extern (C):
20
21 version( Windows )
22 {
23 struct tm
24 {
25 int tm_sec; // seconds after the minute - [0, 60]
26 int tm_min; // minutes after the hour - [0, 59]
27 int tm_hour; // hours since midnight - [0, 23]
28 int tm_mday; // day of the month - [1, 31]
29 int tm_mon; // months since January - [0, 11]
30 int tm_year; // years since 1900
31 int tm_wday; // days since Sunday - [0, 6]
32 int tm_yday; // days since January 1 - [0, 365]
33 int tm_isdst; // Daylight Saving Time flag
34 }
35 }
36 else
37 {
38 struct tm
39 {
40 int tm_sec; // seconds after the minute [0-60]
41 int tm_min; // minutes after the hour [0-59]
42 int tm_hour; // hours since midnight [0-23]
43 int tm_mday; // day of the month [1-31]
44 int tm_mon; // months since January [0-11]
45 int tm_year; // years since 1900
46 int tm_wday; // days since Sunday [0-6]
47 int tm_yday; // days since January 1 [0-365]
48 int tm_isdst; // Daylight Savings Time flag
49 c_long tm_gmtoff; // offset from CUT in seconds
50 char* tm_zone; // timezone abbreviation
51 }
52 }
53
54 alias c_long time_t;
55 alias c_long clock_t;
56
57 version( Windows )
58 {
59 clock_t CLOCKS_PER_SEC = 1000;
60 }
61 else version( OSX )
62 {
63 clock_t CLOCKS_PER_SEC = 100;
64 }
65 else version( freebsd )
66 {
67 clock_t CLOCKS_PER_SEC = 128;
68 }
69 else
70 {
71 clock_t CLOCKS_PER_SEC = 1000000;
72 }
73
74 clock_t clock();
75 double difftime(time_t time1, time_t time0);
76 time_t mktime(tm* timeptr);
77 time_t time(time_t* timer);
78 char* asctime(in tm* timeptr);
79 char* ctime(in time_t* timer);
80 tm* gmtime(in time_t* timer);
81 tm* localtime(in time_t* timer);
82 size_t strftime(char* s, size_t maxsize, in char* format, in tm* timeptr);
83
84 version( Windows )
85 {
86 void tzset(); // non-standard
87 void _tzset(); // non-standard
88 char* _strdate(char* s); // non-standard
89 char* _strtime(char* s); // non-standard
90 }
91 else version( linux )
92 {
93 void tzset(); // non-standard
94 }
95 else version( freebsd )
96 {
97 void tzset(); // non-standard
98 }