From b198119b4c2ee5b4b30f60d9717fa2b46dc6eacd Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 28 Dec 2015 15:44:28 +0100 Subject: use CLOCK_BOOTTIME rather than CLOCK_MONOTONIC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows use to be suspend-aware and we do not have to deal with the processes may not have the same epoch on CLOCK_MONOTONIC. Signed-off-by: Mattias Andrée --- src/parse_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/parse_time.c b/src/parse_time.c index 51e9011..bb1b59e 100644 --- a/src/parse_time.c +++ b/src/parse_time.c @@ -219,7 +219,7 @@ parse_time(const char *str, struct timespec *ts, clockid_t *clk) /* Get current time and clock. */ clock_gettime(CLOCK_REALTIME, &now); - *clk = plus ? CLOCK_MONOTONIC : CLOCK_REALTIME; + *clk = plus ? CLOCK_BOOTTIME : CLOCK_REALTIME; /* Mañana? */ if (!strcmp(str, "mañana")) { /* Do not documented. */ @@ -263,7 +263,7 @@ parse_time(const char *str, struct timespec *ts, clockid_t *clk) /* Check for error at end, and missing explicit UTC. */ if (*str) { - if (*clk == CLOCK_MONOTONIC) + if (*clk == CLOCK_BOOTTIME) FAIL(EINVAL); while (*str == ' ') str++; if (!strcasecmp(str, "Z") && !strcasecmp(str, "UTC")) @@ -276,7 +276,7 @@ parse_time(const char *str, struct timespec *ts, clockid_t *clk) } /* Adjust the day? */ - if (*clk == CLOCK_MONOTONIC) + if (*clk == CLOCK_BOOTTIME) return 0; if (ts->tv_sec < now.tv_sec) { /* Ignore partial second. */ ts->tv_sec += ONE_DAY; -- cgit v1.2.3-70-g09d2