aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@member.fsf.org>2015-12-28 15:44:28 +0100
committerMattias Andrée <maandree@member.fsf.org>2015-12-28 15:44:28 +0100
commitb198119b4c2ee5b4b30f60d9717fa2b46dc6eacd (patch)
treec1c83f0ecd5e9fd4e79c44e50a0a1fa2e5a22157
parent... (diff)
downloadsat-b198119b4c2ee5b4b30f60d9717fa2b46dc6eacd.tar.gz
sat-b198119b4c2ee5b4b30f60d9717fa2b46dc6eacd.tar.bz2
sat-b198119b4c2ee5b4b30f60d9717fa2b46dc6eacd.tar.xz
use CLOCK_BOOTTIME rather than CLOCK_MONOTONIC
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 <maandree@member.fsf.org>
-rw-r--r--src/parse_time.c6
1 files 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;