1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

Move and promote getmonotime() to an internal API function.

This commit is contained in:
claudio 2021-11-04 14:24:41 +00:00
parent 4120df8f0f
commit 2cc3b5f121
3 changed files with 14 additions and 13 deletions

View File

@ -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 <kristaps@bsd.lv>
*
@ -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 *);

View File

@ -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 <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@ -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.

View File

@ -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 <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@ -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)
{