util: teach parse_timestamp() to parse results of format_timestamp_relative()
This commit is contained in:
@@ -344,6 +344,19 @@ int parse_timestamp(const char *t, usec_t *usec) {
|
||||
return r;
|
||||
|
||||
goto finish;
|
||||
|
||||
} else if (endswith(t, " ago")) {
|
||||
_cleanup_free_ char *z;
|
||||
|
||||
z = strndup(t, strlen(t) - 4);
|
||||
if (!z)
|
||||
return -ENOMEM;
|
||||
|
||||
r = parse_usec(z, &minus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
goto finish;
|
||||
}
|
||||
|
||||
copy = tm;
|
||||
|
||||
Reference in New Issue
Block a user