summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index e2f8b1fb78..9a45e6058e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -148,7 +148,8 @@ usec_t timespec_load(const struct timespec *ts) {
ts->tv_nsec == (long) -1)
return (usec_t) -1;
- if (USEC_PER_SEC > ((UINT64_MAX - (ts->tv_nsec / NSEC_PER_USEC)) / (usec_t) ts->tv_sec))
+ if (ts->tv_sec > 0 &&
+ USEC_PER_SEC > ((UINT64_MAX - (ts->tv_nsec / NSEC_PER_USEC)) / (usec_t) ts->tv_sec))
return (usec_t) -1;
return