diff options
Diffstat (limited to 'usr.sbin/bind/lib/isc/unix/time.c')
| -rw-r--r-- | usr.sbin/bind/lib/isc/unix/time.c | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/usr.sbin/bind/lib/isc/unix/time.c b/usr.sbin/bind/lib/isc/unix/time.c index 6de20df0056..34cfde620d2 100644 --- a/usr.sbin/bind/lib/isc/unix/time.c +++ b/usr.sbin/bind/lib/isc/unix/time.c @@ -1,21 +1,21 @@ /* + * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM - * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL - * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. */ -/* $ISC: time.c,v 1.34.2.7 2003/10/09 07:32:52 marka Exp $ */ +/* $ISC: time.c,v 1.34.2.6.2.4 2004/03/06 08:15:03 marka Exp $ */ #include <config.h> @@ -77,7 +77,7 @@ fix_tv_usec(struct timeval *tv) { * Call syslog directly as was are called from the logging functions. */ if (fixed) - syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); + (void)syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); } #endif @@ -93,7 +93,7 @@ isc_interval_set(isc_interval_t *i, } isc_boolean_t -isc_interval_iszero(isc_interval_t *i) { +isc_interval_iszero(const isc_interval_t *i) { REQUIRE(i != NULL); INSIST(i->nanoseconds < NS_PER_S); @@ -129,7 +129,7 @@ isc_time_settoepoch(isc_time_t *t) { } isc_boolean_t -isc_time_isepoch(isc_time_t *t) { +isc_time_isepoch(const isc_time_t *t) { REQUIRE(t != NULL); INSIST(t->nanoseconds < NS_PER_S); @@ -183,7 +183,7 @@ isc_time_now(isc_time_t *t) { } isc_result_t -isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) { +isc_time_nowplusinterval(isc_time_t *t, const isc_interval_t *i) { struct timeval tv; char strbuf[ISC_STRERRORSIZE]; @@ -234,7 +234,7 @@ isc_time_nowplusinterval(isc_time_t *t, isc_interval_t *i) { } int -isc_time_compare(isc_time_t *t1, isc_time_t *t2) { +isc_time_compare(const isc_time_t *t1, const isc_time_t *t2) { REQUIRE(t1 != NULL && t2 != NULL); INSIST(t1->nanoseconds < NS_PER_S && t2->nanoseconds < NS_PER_S); @@ -250,7 +250,8 @@ isc_time_compare(isc_time_t *t1, isc_time_t *t2) { } isc_result_t -isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { +isc_time_add(const isc_time_t *t, const isc_interval_t *i, isc_time_t *result) +{ REQUIRE(t != NULL && i != NULL && result != NULL); INSIST(t->nanoseconds < NS_PER_S && i->nanoseconds < NS_PER_S); @@ -275,7 +276,9 @@ isc_time_add(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { } isc_result_t -isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { +isc_time_subtract(const isc_time_t *t, const isc_interval_t *i, + isc_time_t *result) +{ REQUIRE(t != NULL && i != NULL && result != NULL); INSIST(t->nanoseconds < NS_PER_S && i->nanoseconds < NS_PER_S); @@ -297,7 +300,7 @@ isc_time_subtract(isc_time_t *t, isc_interval_t *i, isc_time_t *result) { } isc_uint64_t -isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) { +isc_time_microdiff(const isc_time_t *t1, const isc_time_t *t2) { isc_uint64_t i1, i2, i3; REQUIRE(t1 != NULL && t2 != NULL); @@ -320,7 +323,7 @@ isc_time_microdiff(isc_time_t *t1, isc_time_t *t2) { } isc_uint32_t -isc_time_seconds(isc_time_t *t) { +isc_time_seconds(const isc_time_t *t) { REQUIRE(t != NULL); INSIST(t->nanoseconds < NS_PER_S); @@ -328,7 +331,7 @@ isc_time_seconds(isc_time_t *t) { } isc_result_t -isc_time_secondsastimet(isc_time_t *t, time_t *secondsp) { +isc_time_secondsastimet(const isc_time_t *t, time_t *secondsp) { isc_uint64_t i; time_t seconds; @@ -383,7 +386,7 @@ isc_time_secondsastimet(isc_time_t *t, time_t *secondsp) { } isc_uint32_t -isc_time_nanoseconds(isc_time_t *t) { +isc_time_nanoseconds(const isc_time_t *t) { REQUIRE(t != NULL); ENSURE(t->nanoseconds < NS_PER_S); @@ -399,11 +402,11 @@ isc_time_formattimestamp(const isc_time_t *t, char *buf, unsigned int len) { REQUIRE(len > 0); now = (time_t) t->seconds; - flen = strftime(buf, len, "%b %d %X", localtime(&now)); + flen = strftime(buf, len, "%d-%b-%Y %X", localtime(&now)); INSIST(flen < len); if (flen != 0) snprintf(buf + flen, len - flen, ".%03u", t->nanoseconds / 1000000); else - snprintf(buf, len, "Bad 00 99:99:99.999"); + snprintf(buf, len, "99-Bad-9999 99:99:99.999"); } |
