Merge pull request #5406 from Doxense/fix-windows-build-with-system-time
Fix windows build with system time
This commit is contained in:
commit
38f9cbd8b6
|
@ -1964,16 +1964,29 @@ void parse(StringRef& val, WaitState& w) {
|
|||
|
||||
void parse(StringRef& val, time_t& t) {
|
||||
struct tm tm = { 0 };
|
||||
#ifdef _WIN32
|
||||
std::istringstream s(val.toString());
|
||||
s.imbue(std::locale(setlocale(LC_TIME, nullptr)));
|
||||
s >> std::get_time(&tm, "%FT%T%z");
|
||||
if (s.fail()) {
|
||||
throw std::invalid_argument("failed to parse ISO 8601 datetime");
|
||||
}
|
||||
long timezone;
|
||||
if (_get_timezone(&timezone) != 0) {
|
||||
throw std::runtime_error("failed to convert ISO 8601 datetime");
|
||||
}
|
||||
timezone = -timezone;
|
||||
#else
|
||||
if (strptime(val.toString().c_str(), "%FT%T%z", &tm) == nullptr) {
|
||||
throw std::invalid_argument("failed to parse ISO 8601 datetime");
|
||||
}
|
||||
|
||||
long timezone = tm.tm_gmtoff;
|
||||
t = timegm(&tm);
|
||||
if (t == -1) {
|
||||
throw std::runtime_error("failed to convert ISO 8601 datetime");
|
||||
}
|
||||
t -= timezone;
|
||||
#endif
|
||||
}
|
||||
|
||||
void parse(StringRef& val, NetworkAddress& a) {
|
||||
|
|
|
@ -19,6 +19,11 @@ extern "C" void stackSignalHandler(int sig) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SIGUSR1 10
|
||||
#define SIGUSR2 12
|
||||
#endif
|
||||
|
||||
void setupStackSignal() {
|
||||
std::signal(SIGUSR1, &stackSignalHandler);
|
||||
}
|
||||
|
|
|
@ -150,13 +150,13 @@
|
|||
</Component>
|
||||
|
||||
<Component Id='FDBCRegistryValue' Guid='{6ED940F3-75C8-4385-97D9-D7D0F211B17D}' Win64='yes'>
|
||||
<RegistryKey Root='HKLM' Key='SOFTWARE\$(var.Manufacturer)\KeyValue\Client' Action='createAndRemoveOnUninstall'>
|
||||
<RegistryKey Root='HKLM' Key='SOFTWARE\$(var.Manufacturer)\KeyValue\Client'>
|
||||
<RegistryValue Name='Version' Type='string' Value='$(var.Version)' KeyPath='yes' />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
|
||||
<Component Id='FDBSRegistryValue' Guid='{361A9B4A-A06F-4BFB-AFEA-B5F733C8BFDF}' Win64='yes'>
|
||||
<RegistryKey Root='HKLM' Key='SOFTWARE\$(var.Manufacturer)\KeyValue\Server' Action='createAndRemoveOnUninstall'>
|
||||
<RegistryKey Root='HKLM' Key='SOFTWARE\$(var.Manufacturer)\KeyValue\Server'>
|
||||
<RegistryValue Name='Version' Type='string' Value='$(var.Version)' KeyPath='yes' />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
|
|
Loading…
Reference in New Issue