tree-wide: stop assigning colon prefixed timezone to $TZ

glibc (and also musl, though we do not officially support it yet)
silently ignores colon prefix in $TZ. Let's always not prefix the
timezone.

tzset(3) states:
> A nonempty value of TZ can be one of two formats, either of which can
> be preceded by a colon which is ignored.

Addresses https://github.com/systemd/systemd/pull/38876#discussion_r2384347594.
This commit is contained in:
Yu Watanabe
2025-09-28 11:14:00 +09:00
parent 7d6f1d695c
commit 8431368668
4 changed files with 7 additions and 18 deletions
+1 -1
View File
@@ -1022,7 +1022,7 @@ int parse_timestamp(const char *t, usec_t *ret) {
if (timezone_is_valid(tz, LOG_DEBUG)) {
SAVE_TIMEZONE;
if (setenv("TZ", strjoina(":", tz), /* overwrite = */ true) < 0)
if (setenv("TZ", tz, /* overwrite = */ true) < 0)
return negative_errno();
return parse_timestamp_impl(t, max_len, /* utc = */ false, /* isdst = */ -1, /* gmtoff = */ 0, ret);