cscg24-guacamole

CSCG 2024 Challenge 'Guacamole Mashup'
git clone https://git.sinitax.com/sinitax/cscg24-guacamole
Log | Files | Refs | sfeed.txt

timezone.h (4168B)


      1/**
      2 * WinPR: Windows Portable Runtime
      3 * Time Zone
      4 *
      5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
      6 *
      7 * Licensed under the Apache License, Version 2.0 (the "License");
      8 * you may not use this file except in compliance with the License.
      9 * You may obtain a copy of the License at
     10 *
     11 *     http://www.apache.org/licenses/LICENSE-2.0
     12 *
     13 * Unless required by applicable law or agreed to in writing, software
     14 * distributed under the License is distributed on an "AS IS" BASIS,
     15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 * See the License for the specific language governing permissions and
     17 * limitations under the License.
     18 */
     19
     20#ifndef WINPR_TIMEZONE_H
     21#define WINPR_TIMEZONE_H
     22
     23#include <winpr/winpr.h>
     24#include <winpr/wtypes.h>
     25
     26#include <winpr/windows.h>
     27
     28#ifdef __cplusplus
     29extern "C"
     30{
     31#endif
     32
     33#ifndef _WIN32
     34
     35	typedef struct _TIME_ZONE_INFORMATION
     36	{
     37		LONG Bias;
     38		WCHAR StandardName[32];
     39		SYSTEMTIME StandardDate;
     40		LONG StandardBias;
     41		WCHAR DaylightName[32];
     42		SYSTEMTIME DaylightDate;
     43		LONG DaylightBias;
     44	} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;
     45
     46	typedef struct _TIME_DYNAMIC_ZONE_INFORMATION
     47	{
     48		LONG Bias;
     49		WCHAR StandardName[32];
     50		SYSTEMTIME StandardDate;
     51		LONG StandardBias;
     52		WCHAR DaylightName[32];
     53		SYSTEMTIME DaylightDate;
     54		LONG DaylightBias;
     55		WCHAR TimeZoneKeyName[128];
     56		BOOLEAN DynamicDaylightTimeDisabled;
     57	} DYNAMIC_TIME_ZONE_INFORMATION, *PDYNAMIC_TIME_ZONE_INFORMATION,
     58	    *LPDYNAMIC_TIME_ZONE_INFORMATION;
     59
     60	WINPR_API DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation);
     61	WINPR_API BOOL SetTimeZoneInformation(const TIME_ZONE_INFORMATION* lpTimeZoneInformation);
     62	WINPR_API BOOL SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime);
     63	WINPR_API BOOL FileTimeToSystemTime(const FILETIME* lpFileTime, LPSYSTEMTIME lpSystemTime);
     64	WINPR_API BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
     65	                                               LPSYSTEMTIME lpUniversalTime,
     66	                                               LPSYSTEMTIME lpLocalTime);
     67	WINPR_API BOOL TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,
     68	                                               LPSYSTEMTIME lpLocalTime,
     69	                                               LPSYSTEMTIME lpUniversalTime);
     70
     71#endif
     72
     73/*
     74 * GetDynamicTimeZoneInformation is provided by the SDK if _WIN32_WINNT >= 0x0600 in SDKs above 7.1A
     75 * and incorrectly if _WIN32_WINNT >= 0x0501 in older SDKs
     76 */
     77#if !defined(_WIN32) ||                                                  \
     78    (defined(_WIN32) && (defined(NTDDI_WIN8) && _WIN32_WINNT < 0x0600 || \
     79                         !defined(NTDDI_WIN8) && _WIN32_WINNT < 0x0501)) /* Windows Vista */
     80
     81	WINPR_API DWORD
     82	GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation);
     83	WINPR_API BOOL
     84	SetDynamicTimeZoneInformation(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation);
     85	WINPR_API BOOL GetTimeZoneInformationForYear(USHORT wYear, PDYNAMIC_TIME_ZONE_INFORMATION pdtzi,
     86	                                             LPTIME_ZONE_INFORMATION ptzi);
     87
     88#endif
     89
     90#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0601)) /* Windows 7 */
     91
     92	WINPR_API BOOL
     93	SystemTimeToTzSpecificLocalTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation,
     94	                                  const SYSTEMTIME* lpUniversalTime, LPSYSTEMTIME lpLocalTime);
     95	WINPR_API BOOL
     96	TzSpecificLocalTimeToSystemTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation,
     97	                                  const SYSTEMTIME* lpLocalTime, LPSYSTEMTIME lpUniversalTime);
     98
     99#endif
    100
    101#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602)) /* Windows 8 */
    102
    103	WINPR_API DWORD EnumDynamicTimeZoneInformation(
    104	    const DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation);
    105	WINPR_API DWORD GetDynamicTimeZoneInformationEffectiveYears(
    106	    const PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation, LPDWORD FirstYear,
    107	    LPDWORD LastYear);
    108
    109#endif
    110
    111#ifdef __cplusplus
    112}
    113#endif
    114
    115#endif /* WINPR_TIMEZONE_H */