summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-02-13 19:43:58 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-02-24 00:55:27 +0100
commit17d1ebfc43c3b971d20ff2806acc634ee153eef6 (patch)
treeacd508c8c4cf3c9f1d70fabec8cf8f279efc5a1d /src
parenttime-util: add assertions (diff)
downloadsystemd-17d1ebfc43c3b971d20ff2806acc634ee153eef6.tar.xz
systemd-17d1ebfc43c3b971d20ff2806acc634ee153eef6.zip
time-util: drop redundant else
Diffstat (limited to 'src')
-rw-r--r--src/basic/time-util.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index f563b8560c..54624afda1 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -665,21 +665,23 @@ static int parse_timestamp_impl(const char *t, usec_t *ret, bool with_tz) {
if (streq(t, "now"))
goto finish;
- else if (t[0] == '+') {
+ if (t[0] == '+') {
r = parse_sec(t+1, &plus);
if (r < 0)
return r;
goto finish;
+ }
- } else if (t[0] == '-') {
+ if (t[0] == '-') {
r = parse_sec(t+1, &minus);
if (r < 0)
return r;
goto finish;
+ }
- } else if ((k = endswith(t, " ago"))) {
+ if ((k = endswith(t, " ago"))) {
t = strndupa_safe(t, k - t);
r = parse_sec(t, &minus);
@@ -687,8 +689,9 @@ static int parse_timestamp_impl(const char *t, usec_t *ret, bool with_tz) {
return r;
goto finish;
+ }
- } else if ((k = endswith(t, " left"))) {
+ if ((k = endswith(t, " left"))) {
t = strndupa_safe(t, k - t);
r = parse_sec(t, &plus);