xref: /freebsd-src/contrib/ntp/libntp/lib/isc/win32/include/isc/stdtime.h (revision a466cc55373fc3cf86837f09da729535b57e69a1)
1*a466cc55SCy Schubert /*
2*a466cc55SCy Schubert  * Copyright (C) 2004, 2005, 2007, 2011, 2012  Internet Systems Consortium, Inc. ("ISC")
3*a466cc55SCy Schubert  * Copyright (C) 1999-2001  Internet Software Consortium.
4*a466cc55SCy Schubert  *
5*a466cc55SCy Schubert  * Permission to use, copy, modify, and/or distribute this software for any
6*a466cc55SCy Schubert  * purpose with or without fee is hereby granted, provided that the above
7*a466cc55SCy Schubert  * copyright notice and this permission notice appear in all copies.
8*a466cc55SCy Schubert  *
9*a466cc55SCy Schubert  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10*a466cc55SCy Schubert  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11*a466cc55SCy Schubert  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12*a466cc55SCy Schubert  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13*a466cc55SCy Schubert  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14*a466cc55SCy Schubert  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15*a466cc55SCy Schubert  * PERFORMANCE OF THIS SOFTWARE.
16*a466cc55SCy Schubert  */
17*a466cc55SCy Schubert 
18*a466cc55SCy Schubert /* $Id$ */
19*a466cc55SCy Schubert 
20*a466cc55SCy Schubert #ifndef ISC_STDTIME_H
21*a466cc55SCy Schubert #define ISC_STDTIME_H 1
22*a466cc55SCy Schubert 
23*a466cc55SCy Schubert #include <isc/lang.h>
24*a466cc55SCy Schubert #include <isc/int.h>
25*a466cc55SCy Schubert 
26*a466cc55SCy Schubert /*
27*a466cc55SCy Schubert  * It's public information that 'isc_stdtime_t' is an unsigned integral type.
28*a466cc55SCy Schubert  * Applications that want maximum portability should not assume anything
29*a466cc55SCy Schubert  * about its size.
30*a466cc55SCy Schubert  */
31*a466cc55SCy Schubert typedef isc_uint32_t isc_stdtime_t;
32*a466cc55SCy Schubert 
33*a466cc55SCy Schubert /* but this flag helps... */
34*a466cc55SCy Schubert #define STDTIME_ON_32BITS	1
35*a466cc55SCy Schubert 
36*a466cc55SCy Schubert /*
37*a466cc55SCy Schubert  * isc_stdtime32_t is a 32-bit version of isc_stdtime_t.  A variable of this
38*a466cc55SCy Schubert  * type should only be used as an opaque integer (e.g.,) to compare two
39*a466cc55SCy Schubert  * time values.
40*a466cc55SCy Schubert  */
41*a466cc55SCy Schubert typedef isc_uint32_t isc_stdtime32_t;
42*a466cc55SCy Schubert 
43*a466cc55SCy Schubert ISC_LANG_BEGINDECLS
44*a466cc55SCy Schubert 
45*a466cc55SCy Schubert void
46*a466cc55SCy Schubert isc_stdtime_get(isc_stdtime_t *t);
47*a466cc55SCy Schubert /*
48*a466cc55SCy Schubert  * Set 't' to the number of seconds since 00:00:00 UTC, January 1, 1970.
49*a466cc55SCy Schubert  *
50*a466cc55SCy Schubert  * Requires:
51*a466cc55SCy Schubert  *
52*a466cc55SCy Schubert  *	't' is a valid pointer.
53*a466cc55SCy Schubert  */
54*a466cc55SCy Schubert 
55*a466cc55SCy Schubert #define isc_stdtime_convert32(t, t32p) (*(t32p) = t)
56*a466cc55SCy Schubert /*
57*a466cc55SCy Schubert  * Convert the standard time to its 32-bit version.
58*a466cc55SCy Schubert  */
59*a466cc55SCy Schubert 
60*a466cc55SCy Schubert ISC_LANG_ENDDECLS
61*a466cc55SCy Schubert 
62*a466cc55SCy Schubert #endif /* ISC_STDTIME_H */
63