time-util: do not carry musl-specific fallback logic on glibc systems

Follow-up for 3ac4d68498

We have no sensible way to detect why strptime() fails, hence
the fallback path as it is now would fire on glibc systems too,
pointlessly. Let's guard it behind ifdeffery.
This commit is contained in:
Mike Yuan
2025-11-13 09:40:20 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 4a028994df
commit 6dd412bc50
+6 -2
View File
@@ -634,8 +634,6 @@ const char* get_tzname(bool dst) {
}
int parse_gmtoff(const char *t, long *ret) {
int r;
assert(t);
struct tm tm;
@@ -647,6 +645,11 @@ int parse_gmtoff(const char *t, long *ret) {
return 0;
}
#ifdef __GLIBC__
return -EINVAL;
#else
int r;
/* musl v1.2.5 does not support %z specifier in strptime(). Since
* https://github.com/kraj/musl/commit/fced99e93daeefb0192fd16304f978d4401d1d77
* %z is supported, but it only supports strict RFC-822/ISO 8601 format, that is, 4 digits with sign
@@ -714,6 +717,7 @@ finalize:
}
return 0;
#endif
}
static int parse_timestamp_impl(