mirror of
https://github.com/HowardHinnant/date.git
synced 2024-12-28 17:28:15 +08:00
Enable current_zone() on FreeBSD
This commit is contained in:
parent
41563c46e8
commit
5f01382e24
14
tz.cpp
14
tz.cpp
@ -3612,6 +3612,20 @@ TZ_DB::current_zone() const
|
|||||||
// Fall through to try other means.
|
// Fall through to try other means.
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
// On some versions of some bsd distro's (e.g. FreeBSD),
|
||||||
|
// the current timezone might be in the first line of
|
||||||
|
// the /var/db/zoneinfo file.
|
||||||
|
std::ifstream timezone_file("/var/db/zoneinfo");
|
||||||
|
if (timezone_file.is_open())
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
std::getline(timezone_file, result);
|
||||||
|
if (!result.empty())
|
||||||
|
return locate_zone(result);
|
||||||
|
}
|
||||||
|
// Fall through to try other means.
|
||||||
|
}
|
||||||
|
{
|
||||||
// On some versions of some linux distro's (e.g. Red Hat),
|
// On some versions of some linux distro's (e.g. Red Hat),
|
||||||
// the current timezone might be in the first line of
|
// the current timezone might be in the first line of
|
||||||
// the /etc/sysconfig/clock file as:
|
// the /etc/sysconfig/clock file as:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user