From: claudio Date: Thu, 4 Nov 2021 14:24:41 +0000 (+0000) Subject: Move and promote getmonotime() to an internal API function. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2cc3b5f1219a5f184049651f3378193ab341223c;p=openbsd Move and promote getmonotime() to an internal API function. --- diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index f0636833fdf..35efc809bd3 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.92 2021/11/04 14:21:19 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.93 2021/11/04 14:24:41 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -599,6 +599,7 @@ int output_json(FILE *, struct vrp_tree *, struct brk_tree *, void logx(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +time_t getmonotime(void); int mkpath(const char *); diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index 25d951ae302..f564e510e40 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.47 2021/11/03 13:29:28 claudio Exp $ */ +/* $OpenBSD: http.c,v 1.48 2021/11/04 14:24:41 claudio Exp $ */ /* * Copyright (c) 2020 Nils Fisher * Copyright (c) 2020 Claudio Jeker @@ -193,16 +193,6 @@ static enum res proxy_read(struct http_connection *); static enum res proxy_write(struct http_connection *); static enum res data_write(struct http_connection *); -static time_t -getmonotime(void) -{ - struct timespec ts; - - if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) - err(1, "clock_gettime"); - return (ts.tv_sec); -} - /* * Return a string that can be used in error message to identify the * connection. diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 0da458ebf52..c11a28b3122 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.161 2021/11/04 11:32:55 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.162 2021/11/04 14:24:41 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -86,6 +86,16 @@ logx(const char *fmt, ...) } } +time_t +getmonotime(void) +{ + struct timespec ts; + + if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + err(1, "clock_gettime"); + return (ts.tv_sec); +} + void entity_free(struct entity *ent) {