xref: /aosp_15_r20/bionic/libc/include/time64.h (revision 8d67ca893c1523eb926b9080dbe4e2ffd2a27ba1)
1*8d67ca89SAndroid Build Coastguard Worker /*
2*8d67ca89SAndroid Build Coastguard Worker 
3*8d67ca89SAndroid Build Coastguard Worker Copyright (c) 2007-2008  Michael G Schwern
4*8d67ca89SAndroid Build Coastguard Worker 
5*8d67ca89SAndroid Build Coastguard Worker This software originally derived from Paul Sheer's pivotal_gmtime_r.c.
6*8d67ca89SAndroid Build Coastguard Worker 
7*8d67ca89SAndroid Build Coastguard Worker The MIT License:
8*8d67ca89SAndroid Build Coastguard Worker 
9*8d67ca89SAndroid Build Coastguard Worker Permission is hereby granted, free of charge, to any person obtaining a copy
10*8d67ca89SAndroid Build Coastguard Worker of this software and associated documentation files (the "Software"), to deal
11*8d67ca89SAndroid Build Coastguard Worker in the Software without restriction, including without limitation the rights
12*8d67ca89SAndroid Build Coastguard Worker to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13*8d67ca89SAndroid Build Coastguard Worker copies of the Software, and to permit persons to whom the Software is
14*8d67ca89SAndroid Build Coastguard Worker furnished to do so, subject to the following conditions:
15*8d67ca89SAndroid Build Coastguard Worker 
16*8d67ca89SAndroid Build Coastguard Worker The above copyright notice and this permission notice shall be included in
17*8d67ca89SAndroid Build Coastguard Worker all copies or substantial portions of the Software.
18*8d67ca89SAndroid Build Coastguard Worker 
19*8d67ca89SAndroid Build Coastguard Worker THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20*8d67ca89SAndroid Build Coastguard Worker IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21*8d67ca89SAndroid Build Coastguard Worker FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22*8d67ca89SAndroid Build Coastguard Worker AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23*8d67ca89SAndroid Build Coastguard Worker LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24*8d67ca89SAndroid Build Coastguard Worker OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25*8d67ca89SAndroid Build Coastguard Worker THE SOFTWARE.
26*8d67ca89SAndroid Build Coastguard Worker 
27*8d67ca89SAndroid Build Coastguard Worker */
28*8d67ca89SAndroid Build Coastguard Worker #ifndef TIME64_H
29*8d67ca89SAndroid Build Coastguard Worker #define TIME64_H
30*8d67ca89SAndroid Build Coastguard Worker 
31*8d67ca89SAndroid Build Coastguard Worker #if defined(__LP64__)
32*8d67ca89SAndroid Build Coastguard Worker 
33*8d67ca89SAndroid Build Coastguard Worker #error Your time_t is already 64-bit.
34*8d67ca89SAndroid Build Coastguard Worker 
35*8d67ca89SAndroid Build Coastguard Worker #else
36*8d67ca89SAndroid Build Coastguard Worker 
37*8d67ca89SAndroid Build Coastguard Worker /* Legacy cruft for LP32 where time_t was 32-bit. */
38*8d67ca89SAndroid Build Coastguard Worker 
39*8d67ca89SAndroid Build Coastguard Worker #include <sys/cdefs.h>
40*8d67ca89SAndroid Build Coastguard Worker #include <time.h>
41*8d67ca89SAndroid Build Coastguard Worker #include <stdint.h>
42*8d67ca89SAndroid Build Coastguard Worker 
43*8d67ca89SAndroid Build Coastguard Worker __BEGIN_DECLS
44*8d67ca89SAndroid Build Coastguard Worker 
45*8d67ca89SAndroid Build Coastguard Worker typedef int64_t time64_t;
46*8d67ca89SAndroid Build Coastguard Worker 
47*8d67ca89SAndroid Build Coastguard Worker char* _Nullable asctime64(const struct tm* _Nonnull);
48*8d67ca89SAndroid Build Coastguard Worker char* _Nullable asctime64_r(const struct tm* _Nonnull, char* _Nonnull);
49*8d67ca89SAndroid Build Coastguard Worker char* _Nullable ctime64(const time64_t* _Nonnull);
50*8d67ca89SAndroid Build Coastguard Worker char* _Nullable ctime64_r(const time64_t* _Nonnull, char* _Nonnull);
51*8d67ca89SAndroid Build Coastguard Worker struct tm* _Nullable gmtime64(const time64_t* _Nonnull);
52*8d67ca89SAndroid Build Coastguard Worker struct tm* _Nullable gmtime64_r(const time64_t* _Nonnull, struct tm* _Nonnull);
53*8d67ca89SAndroid Build Coastguard Worker struct tm* _Nullable localtime64(const time64_t* _Nonnull);
54*8d67ca89SAndroid Build Coastguard Worker struct tm* _Nullable localtime64_r(const time64_t* _Nonnull, struct tm* _Nonnull);
55*8d67ca89SAndroid Build Coastguard Worker time64_t mktime64(const struct tm* _Nonnull);
56*8d67ca89SAndroid Build Coastguard Worker time64_t timegm64(const struct tm* _Nonnull);
57*8d67ca89SAndroid Build Coastguard Worker time64_t timelocal64(const struct tm* _Nonnull);
58*8d67ca89SAndroid Build Coastguard Worker 
59*8d67ca89SAndroid Build Coastguard Worker __END_DECLS
60*8d67ca89SAndroid Build Coastguard Worker 
61*8d67ca89SAndroid Build Coastguard Worker #endif
62*8d67ca89SAndroid Build Coastguard Worker 
63*8d67ca89SAndroid Build Coastguard Worker #endif /* TIME64_H */
64