Skip to content

Commit

Permalink
Fix current_zone not working on buildroot+glibc target - refs #846
Browse files Browse the repository at this point in the history
The layout for timezones, on these targets, is
`/usr/share/zoneinfo/posix/Europe/Paris` instead of
`/usr/share/zoneinfo/Europe/Paris`.

`/usr/share/zoneinfo/Europe/Paris` exists and is a symlink to
`/usr/share/zoneinfo/posix/Europe/Paris`.

`/etc/localtime` correctly links to `/usr/share/zoneinfo/Europe/Paris`,
so `readlink` must be used instead of `realpath`.

Signed-off-by: Julien Blanc <[email protected]>
  • Loading branch information
Julien-Blanc-tgcm authored and HowardHinnant committed Oct 2, 2024
1 parent 510a054 commit dd8affc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4187,6 +4187,8 @@ sniff_realpath(const char* timezone)
if (rp.get() == nullptr)
throw system_error(errno, system_category(), "realpath() failed");
auto result = extract_tz_name(rp.get());
if (result.find("posix") == 0)
return false;
return result != "posixrules";
}

Expand Down

0 comments on commit dd8affc

Please sign in to comment.