Merge pull request #12597 from keszybz/analyze-timestamp

Analyze timestamps
This commit is contained in:
Lennart Poettering
2019-05-28 14:34:53 +02:00
committed by GitHub
5 changed files with 138 additions and 27 deletions
+7 -8
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;
}