summaryrefslogtreecommitdiffstats
path: root/usr.bin/dig/lib/isc/unix/time.c
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2020-02-16 21:09:32 +0000
committerflorian <florian@openbsd.org>2020-02-16 21:09:32 +0000
commitf9959b0f424a4da2755d69a763c65b4648598893 (patch)
tree6b89eab639ea00376716547f9dfeb21d3d95208a /usr.bin/dig/lib/isc/unix/time.c
parentunravel isc_time_add and isc_time_subtract (diff)
downloadwireguard-openbsd-f9959b0f424a4da2755d69a763c65b4648598893.tar.xz
wireguard-openbsd-f9959b0f424a4da2755d69a763c65b4648598893.zip
unravel isc_time_formattimestamp
OK millert
Diffstat (limited to 'usr.bin/dig/lib/isc/unix/time.c')
-rw-r--r--usr.bin/dig/lib/isc/unix/time.c29
1 files changed, 3 insertions, 26 deletions
diff --git a/usr.bin/dig/lib/isc/unix/time.c b/usr.bin/dig/lib/isc/unix/time.c
index a0f60d032fd..bdc2ea89c0a 100644
--- a/usr.bin/dig/lib/isc/unix/time.c
+++ b/usr.bin/dig/lib/isc/unix/time.c
@@ -14,23 +14,19 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: time.c,v 1.14 2020/02/16 21:08:59 florian Exp $ */
+/* $Id: time.c,v 1.15 2020/02/16 21:09:32 florian Exp $ */
/*! \file */
-
+#include <sys/time.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <time.h>
-
-#include <sys/time.h> /* Required for struct timeval on some platforms. */
-
-
#include <string.h>
-#include <isc/time.h>
+#include <isc/time.h>
#include <isc/util.h>
#define NS_PER_S 1000000000 /*%< Nanoseconds per second. */
@@ -72,25 +68,6 @@ isc_time_microdiff(const struct timespec *t1, const struct timespec *t2) {
}
void
-isc_time_formattimestamp(const struct timespec *t, char *buf, unsigned int len) {
- unsigned int flen;
-
- REQUIRE(t != NULL);
- INSIST(t->tv_nsec < NS_PER_S);
- REQUIRE(buf != NULL);
- REQUIRE(len > 0);
-
- flen = strftime(buf, len, "%d-%b-%Y %X", localtime(&t->tv_sec));
- INSIST(flen < len);
- if (flen != 0) {
- snprintf(buf + flen, len - flen,
- ".%03ld", t->tv_nsec / 1000000);
- } else {
- strlcpy(buf, "99-Bad-9999 99:99:99.999", len);
- }
-}
-
-void
isc_time_formathttptimestamp(const struct timespec *t, char *buf, unsigned int len) {
unsigned int flen;