basic/time-util: make output argument optional

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-05-21 09:53:49 +02:00
parent 9a2b3d3df1
commit a6a67f71bb

View file

@ -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;
}