1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, you can obtain one at https://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #ifndef ISC_STDTIME_H
13 #define ISC_STDTIME_H 1
14 
15 /*! \file */
16 
17 #include <inttypes.h>
18 #include <stdlib.h>
19 
20 #include <isc/lang.h>
21 
22 /*%
23  * It's public information that 'isc_stdtime_t' is an unsigned integral type.
24  * Applications that want maximum portability should not assume anything
25  * about its size.
26  */
27 typedef uint32_t isc_stdtime_t;
28 
29 ISC_LANG_BEGINDECLS
30 /* */
31 void
32 isc_stdtime_get(isc_stdtime_t *t);
33 /*%<
34  * Set 't' to the number of seconds since 00:00:00 UTC, January 1, 1970.
35  *
36  * Requires:
37  *
38  *\li	't' is a valid pointer.
39  */
40 
41 void
42 isc_stdtime_tostring(isc_stdtime_t t, char *out, size_t outlen);
43 /*
44  * Convert 't' into a null-terminated string of the form
45  * "Wed Jun 30 21:49:08 1993". Store the string in the 'out'
46  * buffer.
47  *
48  * Requires:
49  *
50  *	't' is a valid time.
51  *	'out' is a valid pointer.
52  *	'outlen' is at least 26.
53  */
54 
55 #define isc_stdtime_convert32(t, t32p) (*(t32p) = t)
56 /*
57  * Convert the standard time to its 32-bit version.
58  */
59 
60 ISC_LANG_ENDDECLS
61 
62 #endif /* ISC_STDTIME_H */
63