The OpenD Programming Language

1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_time.h.html, _time.h)
5  *
6  * Copyright: Copyright Sean Kelly 2005 - 2009.
7  * License: Distributed under the
8  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9  *    (See accompanying file LICENSE)
10  * Authors:   Sean Kelly,
11  *            Alex Rønne Petersen
12  * Source:    $(DRUNTIMESRC core/stdc/_time.d)
13  * Standards: ISO/IEC 9899:1999 (E)
14  */
15 
16 module core.stdc.time;
17 
18 version (Posix)
19     public import core.sys.posix.stdc.time;
20 else version (Windows)
21     public import core.sys.windows.stdc.time;
22 else version (FreeStanding)
23 {
24   // FIXME
25    struct tm {}
26    alias time_t = int;
27 }
28 else
29     static assert(0, "unsupported system");
30 
31 import core.stdc.config;
32 
33 extern (C):
34 @trusted: // There are only a few functions here that use unsafe C strings.
35 nothrow:
36 @nogc:
37 
38 ///
39 pragma(mangle, muslRedirTime64Mangle!("difftime", "__difftime64"))
40 pure double  difftime(time_t time1, time_t time0); // MT-Safe
41 ///
42 pragma(mangle, muslRedirTime64Mangle!("mktime", "__mktime64"))
43 @system time_t  mktime(scope tm* timeptr); // @system: MT-Safe env locale
44 ///
45 pragma(mangle, muslRedirTime64Mangle!("time", "__time64"))
46 time_t  time(scope time_t* timer);
47 
48 ///
49 @system char*   asctime(const scope tm* timeptr); // @system: MT-Unsafe race:asctime locale
50 ///
51 pragma(mangle, muslRedirTime64Mangle!("ctime", "__ctime64"))
52 @system char*   ctime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf race:asctime env locale
53 ///
54 pragma(mangle, muslRedirTime64Mangle!("gmtime", "__gmtime64"))
55 @system tm*     gmtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale
56 ///
57 pragma(mangle, muslRedirTime64Mangle!("localtime", "__localtime64"))
58 @system tm*     localtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale
59 ///
60 @system size_t  strftime(scope char* s, size_t maxsize, const scope char* format, const scope tm* timeptr); // @system: MT-Safe env locale