mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 14:55:37 +03:00
basic/time-util: make output argument optional
This commit is contained in:
parent
9a2b3d3df1
commit
a6a67f71bb
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user