diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp b/contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp index f69ced4f3e..7ae25b0c62 100644 --- a/contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp +++ b/contrib/libs/poco/Foundation/src/Timezone_WINCE.cpp @@ -1,92 +1,92 @@ -// -// Timezone_WINCE.cpp -// -// Library: Foundation -// Package: DateTime -// Module: Timezone -// -// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Timezone.h" -#include "Poco/UnicodeConverter.h" -#include "Poco/Exception.h" -#include "Poco/UnWindows.h" -#include <ctime> -#if _WIN32_WCE >= 0x800 -#include "time.h" -#else -#error #include "wce_time.h" -#endif - - -namespace Poco { - - -int Timezone::utcOffset() -{ - TIME_ZONE_INFORMATION tzInfo; - DWORD dstFlag = GetTimeZoneInformation(&tzInfo); - return -tzInfo.Bias*60; -} - - -int Timezone::dst() -{ - TIME_ZONE_INFORMATION tzInfo; - DWORD dstFlag = GetTimeZoneInformation(&tzInfo); - return dstFlag == TIME_ZONE_ID_DAYLIGHT ? -tzInfo.DaylightBias*60 : 0; -} - - -bool Timezone::isDst(const Timestamp& timestamp) -{ - std::time_t time = timestamp.epochTime(); -#if _WIN32_WCE >= 0x800 - struct std::tm* tms = localtime(&time); -#else - struct std::tm* tms = wceex_localtime(&time); -#endif - if (!tms) throw SystemException("cannot get local time DST flag"); - return tms->tm_isdst > 0; -} - - -std::string Timezone::name() -{ - std::string result; - TIME_ZONE_INFORMATION tzInfo; - DWORD dstFlag = GetTimeZoneInformation(&tzInfo); - WCHAR* ptr = dstFlag == TIME_ZONE_ID_DAYLIGHT ? tzInfo.DaylightName : tzInfo.StandardName; - UnicodeConverter::toUTF8(ptr, result); - return result; -} - - -std::string Timezone::standardName() -{ - std::string result; - TIME_ZONE_INFORMATION tzInfo; - DWORD dstFlag = GetTimeZoneInformation(&tzInfo); - WCHAR* ptr = tzInfo.StandardName; - UnicodeConverter::toUTF8(ptr, result); - return result; -} - - -std::string Timezone::dstName() -{ - std::string result; - TIME_ZONE_INFORMATION tzInfo; - DWORD dstFlag = GetTimeZoneInformation(&tzInfo); - WCHAR* ptr = tzInfo.DaylightName; - UnicodeConverter::toUTF8(ptr, result); - return result; -} - - -} // namespace Poco +// +// Timezone_WINCE.cpp +// +// Library: Foundation +// Package: DateTime +// Module: Timezone +// +// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Timezone.h" +#include "Poco/UnicodeConverter.h" +#include "Poco/Exception.h" +#include "Poco/UnWindows.h" +#include <ctime> +#if _WIN32_WCE >= 0x800 +#include "time.h" +#else +#error #include "wce_time.h" +#endif + + +namespace Poco { + + +int Timezone::utcOffset() +{ + TIME_ZONE_INFORMATION tzInfo; + DWORD dstFlag = GetTimeZoneInformation(&tzInfo); + return -tzInfo.Bias*60; +} + + +int Timezone::dst() +{ + TIME_ZONE_INFORMATION tzInfo; + DWORD dstFlag = GetTimeZoneInformation(&tzInfo); + return dstFlag == TIME_ZONE_ID_DAYLIGHT ? -tzInfo.DaylightBias*60 : 0; +} + + +bool Timezone::isDst(const Timestamp& timestamp) +{ + std::time_t time = timestamp.epochTime(); +#if _WIN32_WCE >= 0x800 + struct std::tm* tms = localtime(&time); +#else + struct std::tm* tms = wceex_localtime(&time); +#endif + if (!tms) throw SystemException("cannot get local time DST flag"); + return tms->tm_isdst > 0; +} + + +std::string Timezone::name() +{ + std::string result; + TIME_ZONE_INFORMATION tzInfo; + DWORD dstFlag = GetTimeZoneInformation(&tzInfo); + WCHAR* ptr = dstFlag == TIME_ZONE_ID_DAYLIGHT ? tzInfo.DaylightName : tzInfo.StandardName; + UnicodeConverter::toUTF8(ptr, result); + return result; +} + + +std::string Timezone::standardName() +{ + std::string result; + TIME_ZONE_INFORMATION tzInfo; + DWORD dstFlag = GetTimeZoneInformation(&tzInfo); + WCHAR* ptr = tzInfo.StandardName; + UnicodeConverter::toUTF8(ptr, result); + return result; +} + + +std::string Timezone::dstName() +{ + std::string result; + TIME_ZONE_INFORMATION tzInfo; + DWORD dstFlag = GetTimeZoneInformation(&tzInfo); + WCHAR* ptr = tzInfo.DaylightName; + UnicodeConverter::toUTF8(ptr, result); + return result; +} + + +} // namespace Poco |