summaryrefslogtreecommitdiff
path: root/src/basic/time-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-21 09:53:49 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-21 09:56:41 +0200
commita6a67f71bb332611b58c127999e04a4bd2d3298a (patch)
tree548e5ab42561ff387446ed75728a17652e5fa5d0 /src/basic/time-util.c
parent9a2b3d3df170dbaec4d612c2d8bd22003cb2f62d (diff)
downloadsystemd-a6a67f71bb332611b58c127999e04a4bd2d3298a.tar.gz
basic/time-util: make output argument optional
Diffstat (limited to 'src/basic/time-util.c')
-rw-r--r--src/basic/time-util.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index daf952baa1..8ccb4a941a 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -575,7 +575,6 @@ static int parse_timestamp_impl(const char *t, usec_t *usec, bool with_tz) {
*/
assert(t);
- assert(usec);
if (t[0] == '@' && !with_tz)
return parse_sec(t + 1, usec);
@@ -803,8 +802,8 @@ finish:
else
return -EINVAL;
- *usec = ret;
-
+ if (usec)
+ *usec = ret;
return 0;
}
@@ -861,7 +860,7 @@ int parse_timestamp(const char *t, usec_t *usec) {
if (munmap(shared, sizeof *shared) != 0)
return negative_errno();
- if (tmp.return_value == 0)
+ if (tmp.return_value == 0 && usec)
*usec = tmp.usec;
return tmp.return_value;
@@ -923,7 +922,6 @@ int parse_time(const char *t, usec_t *usec, usec_t default_unit) {
bool something = false;
assert(t);
- assert(usec);
assert(default_unit > 0);
p = t;
@@ -935,7 +933,8 @@ int parse_time(const char *t, usec_t *usec, usec_t default_unit) {
if (*s != 0)
return -EINVAL;
- *usec = USEC_INFINITY;
+ if (usec)
+ *usec = USEC_INFINITY;
return 0;
}
@@ -1007,8 +1006,8 @@ int parse_time(const char *t, usec_t *usec, usec_t default_unit) {
}
}
- *usec = r;
-
+ if (usec)
+ *usec = r;
return 0;
}