00001 /* 00002 * Copyright (C) 2004-2007, 2012 Internet Systems Consortium, Inc. ("ISC") 00003 * Copyright (C) 1999-2001 Internet Software Consortium. 00004 * 00005 * Permission to use, copy, modify, and/or distribute this software for any 00006 * purpose with or without fee is hereby granted, provided that the above 00007 * copyright notice and this permission notice appear in all copies. 00008 * 00009 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00010 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00011 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00012 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00013 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00014 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00015 * PERFORMANCE OF THIS SOFTWARE. 00016 */ 00017 00018 /* $Id: time.h,v 1.19 2012/01/27 23:46:58 tbox Exp $ */ 00019 00020 #ifndef DNS_TIME_H 00021 #define DNS_TIME_H 1 00022 00023 /*! \file dns/time.h */ 00024 00025 /*** 00026 *** Imports 00027 ***/ 00028 00029 #include <isc/buffer.h> 00030 #include <isc/lang.h> 00031 00032 ISC_LANG_BEGINDECLS 00033 00034 /*** 00035 *** Functions 00036 ***/ 00037 00038 isc_result_t 00039 dns_time64_fromtext(const char *source, isc_int64_t *target); 00040 /*%< 00041 * Convert a date and time in YYYYMMDDHHMMSS text format at 'source' 00042 * into to a 64-bit count of seconds since Jan 1 1970 0:00 GMT. 00043 * Store the count at 'target'. 00044 */ 00045 00046 isc_result_t 00047 dns_time32_fromtext(const char *source, isc_uint32_t *target); 00048 /*%< 00049 * Like dns_time64_fromtext, but returns the second count modulo 2^32 00050 * as per RFC2535. 00051 */ 00052 00053 00054 isc_result_t 00055 dns_time64_totext(isc_int64_t value, isc_buffer_t *target); 00056 /*%< 00057 * Convert a 64-bit count of seconds since Jan 1 1970 0:00 GMT into 00058 * a YYYYMMDDHHMMSS text representation and append it to 'target'. 00059 */ 00060 00061 isc_result_t 00062 dns_time32_totext(isc_uint32_t value, isc_buffer_t *target); 00063 /*%< 00064 * Like dns_time64_totext, but for a 32-bit cyclic time value. 00065 * Of those dates whose counts of seconds since Jan 1 1970 0:00 GMT 00066 * are congruent with 'value' modulo 2^32, the one closest to the 00067 * current date is chosen. 00068 */ 00069 00070 isc_int64_t 00071 dns_time64_from32(isc_uint32_t value); 00072 /*%< 00073 * Covert a 32-bit cyclic time value into a 64 bit time stamp. 00074 */ 00075 00076 ISC_LANG_ENDDECLS 00077 00078 #endif /* DNS_TIME_H */