HAS_REMOTE_API support for Windows. Adds support for MingW too.

* HAS_REMOTE_API still defaults to 0
* When HAS_REMOTE_API=0 only libraries advapi32.lib, ole32.lib and shell32.lib are required.
* Setting HAS_REMOTE_API=1 requires curl: https://curl.haxx.se/libcurl/
*- Also need to manually install 7-Zip (http://www.7-zip.org).
*- Will automatically install Tinyxml2 (http://www.grinninglizard.com/tinyxml2/).
*- Will automatically install http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
This commit is contained in:
gm 2016-06-14 05:38:47 +12:00 committed by Howard Hinnant
parent 5aa704d5f7
commit 55087c6cbd
4 changed files with 733 additions and 389 deletions

11
date.h
View File

@ -50,17 +50,20 @@ namespace date
// MSVC's constexpr support is still a WIP, even in VS2015.
// Fall back to a lesser mode to support it.
// TODO: Remove this or retest later once MSVC's constexpr improves.
#if defined(_MSC_VER)
#if defined(_MSC_VER) && ! defined(__clang__)
// MS cl compiler.
# define CONSTDATA const
# define CONSTCD11
# define CONSTCD14
# define NOEXCEPT _NOEXCEPT
#elif __cplusplus >= 201402
// C++14
# define CONSTDATA constexpr
# define CONSTCD11 constexpr
# define CONSTCD14 constexpr
# define NOEXCEPT noexcept
#else
// C++11
# define CONSTDATA constexpr
# define CONSTCD11 constexpr
# define CONSTCD14
@ -3826,14 +3829,16 @@ class time_of_day
{
using base = detail::time_of_day_storage<Duration>;
public:
#ifndef _MSC_VER
#if !(_MSC_VER && !defined(__clang__))
// C++11
using base::base;
#else
// MS cl compiler workaround.
template <class ...Args>
explicit time_of_day(Args&& ...args)
: base(std::forward<Args>(args)...)
{}
#endif // _MSC_VER
#endif
};
template <class Rep, class Period,

View File

@ -11,7 +11,6 @@ test_info(const date::time_zone* zone, const date::sys_info& info)
auto mid = begin + (end - begin) /2;
using sys_microseconds = sys_time<microseconds>;
using zoned_microseconds = zoned_time<microseconds>;
using local_microseconds = local_time<microseconds>;
zoned_microseconds local{zone};
if (begin > sys_days{jan/1/1700})

1058
tz.cpp

File diff suppressed because it is too large Load Diff

52
tz.h
View File

@ -29,29 +29,25 @@
// Get more recent database at http://www.iana.org/time-zones
// Questions:
// 1. Reload database.
// 4. Is the utc to sys renaming complete? Was it done correctly?
// The notion of "current timezone" is something the operating system is expected to "just
// know". How it knows this is system specific. It's often a value set by the user at OS
// intallation time and recorded by the OS somewhere. On Linux and Mac systems the current
// timezone name is obtained by looking at the name or contents of a particular file on
// disk. On Windows the current timzeone name comes from the registry. In either method,
// there is no guarantee that the "native" current timezone name obtained will match any
// of the "Standard" names in this library's "database". On Linux, the names usually do
// seem to match so mapping functions to map from native to "Standard" are typically not
// required. On Windows, the names are never "Standard" so mapping is always required.
// Technically any OS may use the mapping process but currently only Windows does use it.
/*
The notion of "current timezone" is something the operating system is expected
to "just know". How it knows this is system specific. It's often a value
set by the user at OS intallation time and recorded by the OS somewhere.
On Linux and Mac systems the current timezone name is obtained by looking at
the name or contents of a particular file on disk.
On Windows the current timzeone name comes from the registry.
In either method, there is no guarantee that the "native" current timezone name obtained
will match any of the "Standard" names in this library's "database".
On Linux, the names usually do seem to match so mapping functions to map from
native to "Standard" are typically not required.
On Windows, the names are never "Standard" so mapping is always required.
Technically any OS may use the mapping process but currently only Windows does use it.
*/
#ifdef _WIN32
#ifndef TIMEZONE_MAPPING
#define TIMEZONE_MAPPING 1
#endif
#if _WIN32
# ifndef TIMEZONE_MAPPING
# define TIMEZONE_MAPPING 1
# endif
#else
# if TIMEZONE_MAPPING
# error "Timezone mapping is not required or not implemented for this platform."
# endif
#endif
#ifndef LAZY_INIT
@ -59,10 +55,10 @@ Technically any OS may use the mapping process but currently only Windows does u
#endif
#ifndef HAS_REMOTE_API
# ifndef _MSC_VER
# define HAS_REMOTE_API 1
# else
# if _WIN32
# define HAS_REMOTE_API 0
# else
# define HAS_REMOTE_API 1
# endif
#endif
@ -735,10 +731,10 @@ bool remote_install(const std::string& version);
const time_zone* locate_zone(const std::string& tz_name);
#ifdef TZ_TEST
#ifdef _WIN32
# if _WIN32
const time_zone* locate_native_zone(const std::string& native_tz_name);
#endif
#endif
# endif // _WIN32
#endif // TZ_TEST
const time_zone* current_zone();
// zoned_time