summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-02-16 21:06:55 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-02-16 21:06:55 +0000
commit2cb31497080b185041f483c87b718b2f641fe83d (patch)
treeee8428d172d0bf656932063955e3ec6df10e0b7b
parente8f3491defb892b2bd792f47e21342fa19662a86 (diff)
remove timespec setters
OK millert
-rw-r--r--usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c9
-rw-r--r--usr.bin/dig/lib/isc/timer.c6
-rw-r--r--usr.bin/dig/lib/isc/unix/include/isc/time.h34
-rw-r--r--usr.bin/dig/lib/isc/unix/time.c18
4 files changed, 11 insertions, 56 deletions
diff --git a/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c b/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c
index 3e9c69b83c0..779ee686b01 100644
--- a/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c
+++ b/usr.bin/dig/lib/dns/rdata/generic/keydata_65533.c
@@ -203,7 +203,8 @@ totext_keydata(ARGS_TOTEXT) {
RETERR(str_totext(tctx->linebreak, target));
RETERR(str_totext("; next refresh: ", target));
- isc_time_set(&t, refresh, 0);
+ t.tv_sec = refresh;
+ t.tv_nsec = 0;
isc_time_formathttptimestamp(&t, rbuf, sizeof(rbuf));
RETERR(str_totext(rbuf, target));
@@ -219,7 +220,8 @@ totext_keydata(ARGS_TOTEXT) {
RETERR(str_totext("; trust pending: ",
target));
}
- isc_time_set(&t, add, 0);
+ t.tv_sec = add;
+ t.tv_nsec = 0;
isc_time_formathttptimestamp(&t, abuf,
sizeof(abuf));
RETERR(str_totext(abuf, target));
@@ -229,7 +231,8 @@ totext_keydata(ARGS_TOTEXT) {
RETERR(str_totext(tctx->linebreak, target));
RETERR(str_totext("; removal pending: ",
target));
- isc_time_set(&t, deltime, 0);
+ t.tv_sec = deltime;
+ t.tv_nsec = 0;
isc_time_formathttptimestamp(&t, dbuf,
sizeof(dbuf));
RETERR(str_totext(dbuf, target));
diff --git a/usr.bin/dig/lib/isc/timer.c b/usr.bin/dig/lib/isc/timer.c
index d6c1ea8777f..1561966c8b2 100644
--- a/usr.bin/dig/lib/isc/timer.c
+++ b/usr.bin/dig/lib/isc/timer.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.13 2020/02/16 21:06:15 florian Exp $ */
+/* $Id: timer.c,v 1.14 2020/02/16 21:06:54 florian Exp $ */
/*! \file */
@@ -317,7 +317,7 @@ isc__timer_reset(isc_timer_t *timer0, const struct timespec *interval,
if (timespecisset(interval)) {
result = isc_time_add(&now, interval, &timer->idle);
} else {
- isc_time_settoepoch(&timer->idle);
+ timespecclear(&timer->idle);
result = ISC_R_SUCCESS;
}
@@ -512,7 +512,7 @@ isc__timermgr_create(isc_timermgr_t **managerp) {
manager->done = ISC_FALSE;
INIT_LIST(manager->timers);
manager->nscheduled = 0;
- isc_time_settoepoch(&manager->due);
+ timespecclear(&manager->due);
manager->heap = NULL;
result = isc_heap_create(sooner, set_index, 0, &manager->heap);
if (result != ISC_R_SUCCESS) {
diff --git a/usr.bin/dig/lib/isc/unix/include/isc/time.h b/usr.bin/dig/lib/isc/unix/include/isc/time.h
index 917c9715562..f67cba1ccce 100644
--- a/usr.bin/dig/lib/isc/unix/include/isc/time.h
+++ b/usr.bin/dig/lib/isc/unix/include/isc/time.h
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.h,v 1.7 2020/02/16 21:06:15 florian Exp $ */
+/* $Id: time.h,v 1.8 2020/02/16 21:06:54 florian Exp $ */
#ifndef ISC_TIME_H
#define ISC_TIME_H 1
@@ -36,38 +36,6 @@
*** Absolute Times
***/
-void
-isc_time_set(struct timespec *t, time_t seconds, long nanoseconds);
-/*%<
- * Set 't' to a value which represents the given number of seconds and
- * nanoseconds since 00:00:00 January 1, 1970, UTC.
- *
- * Notes:
- *\li The Unix version of this call is equivalent to:
- *\code
- * isc_time_settoepoch(t);
- * interval_set(i, seconds, nanoseconds);
- * isc_time_add(t, i, t);
- *\endcode
- *
- * Requires:
- *\li 't' is a valid pointer.
- *\li nanoseconds < 1000000000.
- */
-
-void
-isc_time_settoepoch(struct timespec *t);
-/*%<
- * Set 't' to the time of the epoch.
- *
- * Notes:
- *\li The date of the epoch is platform-dependent.
- *
- * Requires:
- *
- *\li 't' is a valid pointer.
- */
-
isc_boolean_t
isc_time_isepoch(const struct timespec *t);
/*%<
diff --git a/usr.bin/dig/lib/isc/unix/time.c b/usr.bin/dig/lib/isc/unix/time.c
index 77c581a0016..c1e3003cabb 100644
--- a/usr.bin/dig/lib/isc/unix/time.c
+++ b/usr.bin/dig/lib/isc/unix/time.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.10 2020/02/16 21:06:15 florian Exp $ */
+/* $Id: time.c,v 1.11 2020/02/16 21:06:54 florian Exp $ */
/*! \file */
@@ -47,22 +47,6 @@
*** Absolute Times
***/
-void
-isc_time_set(struct timespec *t, time_t seconds, long nanoseconds) {
- REQUIRE(t != NULL);
- REQUIRE(nanoseconds < NS_PER_S);
-
- t->tv_sec = seconds;
- t->tv_nsec = nanoseconds;
-}
-
-void
-isc_time_settoepoch(struct timespec *t) {
- REQUIRE(t != NULL);
-
- timespecclear(t);
-}
-
isc_boolean_t
isc_time_isepoch(const struct timespec *t) {
REQUIRE(t != NULL);