mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-04 21:24:26 +02:00
Rename current_timezone() to current_zone():
* Better symmetry with locate_zone(name).
This commit is contained in:
10
tz.cpp
10
tz.cpp
@@ -2011,7 +2011,7 @@ operator<<(std::ostream& os, const Info& r)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
const Zone*
|
const Zone*
|
||||||
current_timezone()
|
current_zone()
|
||||||
{
|
{
|
||||||
#if TIMEZONE_MAPPING
|
#if TIMEZONE_MAPPING
|
||||||
TIME_ZONE_INFORMATION tzi{};
|
TIME_ZONE_INFORMATION tzi{};
|
||||||
@@ -2027,7 +2027,7 @@ current_timezone()
|
|||||||
if (!tz)
|
if (!tz)
|
||||||
{
|
{
|
||||||
std::string msg;
|
std::string msg;
|
||||||
msg = "current_timezone() failed: ";
|
msg = "current_zone() failed: ";
|
||||||
msg += standard_name;
|
msg += standard_name;
|
||||||
msg += " was not found in the Windows Time Zone registry";
|
msg += " was not found in the Windows Time Zone registry";
|
||||||
throw std::runtime_error( msg );
|
throw std::runtime_error( msg );
|
||||||
@@ -2036,7 +2036,7 @@ current_timezone()
|
|||||||
if (!native_to_standard_timezone_name(tz->timezone_id, standard_tzid))
|
if (!native_to_standard_timezone_name(tz->timezone_id, standard_tzid))
|
||||||
{
|
{
|
||||||
std::string msg;
|
std::string msg;
|
||||||
msg = "current_timezone() failed: A mapping from the Windows Time Zone id \"";
|
msg = "current_zone() failed: A mapping from the Windows Time Zone id \"";
|
||||||
msg += tz->timezone_id;
|
msg += tz->timezone_id;
|
||||||
msg += "\" was not found in the time zone mapping database.";
|
msg += "\" was not found in the time zone mapping database.";
|
||||||
throw std::runtime_error(msg);
|
throw std::runtime_error(msg);
|
||||||
@@ -2044,14 +2044,14 @@ current_timezone()
|
|||||||
return date::locate_zone(standard_tzid);
|
return date::locate_zone(standard_tzid);
|
||||||
#else
|
#else
|
||||||
// Currently Win32 requires mapping for this function to work.
|
// Currently Win32 requires mapping for this function to work.
|
||||||
throw std::runtime_error("current_timezone not implemented.");
|
throw std::runtime_error("current_zone not implemented.");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // ! WIN32
|
#else // ! WIN32
|
||||||
|
|
||||||
const Zone*
|
const Zone*
|
||||||
current_timezone()
|
current_zone()
|
||||||
{
|
{
|
||||||
// On some versions of some linux distro's (e.g. Ubuntu),
|
// On some versions of some linux distro's (e.g. Ubuntu),
|
||||||
// the current timezone might be in the first line of
|
// the current timezone might be in the first line of
|
||||||
|
2
tz.h
2
tz.h
@@ -575,7 +575,7 @@ const Zone* locate_zone(const std::string& tz_name);
|
|||||||
const Zone* locate_native_zone(const std::string& native_tz_name);
|
const Zone* locate_native_zone(const std::string& native_tz_name);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
const Zone* current_timezone();
|
const Zone* current_zone();
|
||||||
|
|
||||||
class utc_clock
|
class utc_clock
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user