chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prep v234: Apply missing upstream fixes in src/basic (1/6)
[elogind.git]
/
src
/
basic
/
time-util.c
diff --git
a/src/basic/time-util.c
b/src/basic/time-util.c
index 7da7ea41c1a632e5896eec40eebbb6dc845e1b8b..be0197f4405b87a9b8463cef8b6a41a644ceda45 100644
(file)
--- a/
src/basic/time-util.c
+++ b/
src/basic/time-util.c
@@
-247,7
+247,7
@@
usec_t timeval_load(const struct timeval *tv) {
struct timeval *timeval_store(struct timeval *tv, usec_t u) {
assert(tv);
struct timeval *timeval_store(struct timeval *tv, usec_t u) {
assert(tv);
- if (u == USEC_INFINITY||
+ if (u == USEC_INFINITY
||
u / USEC_PER_SEC > TIME_T_MAX) {
tv->tv_sec = (time_t) -1;
tv->tv_usec = (suseconds_t) -1;
u / USEC_PER_SEC > TIME_T_MAX) {
tv->tv_sec = (time_t) -1;
tv->tv_usec = (suseconds_t) -1;
@@
-877,10
+877,10
@@
finish:
if (ret > USEC_TIMESTAMP_FORMATTABLE_MAX)
return -EINVAL;
if (ret > USEC_TIMESTAMP_FORMATTABLE_MAX)
return -EINVAL;
- if (ret > minus)
+ if (ret >
=
minus)
ret -= minus;
else
ret -= minus;
else
- ret
= 0
;
+ ret
urn -EINVAL
;
*usec = ret;
*usec = ret;
@@
-1024,6
+1024,16
@@
int parse_sec(const char *t, usec_t *usec) {
}
#if 0 /// UNNEEDED by elogind
}
#if 0 /// UNNEEDED by elogind
+int parse_sec_fix_0(const char *t, usec_t *usec) {
+ t += strspn(t, WHITESPACE);
+ if (streq(t, "0")) {
+ *usec = USEC_INFINITY;
+ return 0;
+ }
+
+ return parse_sec(t, usec);
+}
+
int parse_nsec(const char *t, nsec_t *nsec) {
static const struct {
const char *suffix;
int parse_nsec(const char *t, nsec_t *nsec) {
static const struct {
const char *suffix;