FreeRDP
Loading...
Searching...
No Matches
winpr/include/winpr/timezone.h
1
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
36 {
37 LONG Bias;
38 WCHAR StandardName[32];
39 SYSTEMTIME StandardDate;
40 LONG StandardBias;
41 WCHAR DaylightName[32];
42 SYSTEMTIME DaylightDate;
43 LONG DaylightBias;
45
46 typedef struct
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;
59
65#define TIME_ZONE_ID_UNKNOWN 0
66#define TIME_ZONE_ID_STANDARD 1
67#define TIME_ZONE_ID_DAYLIGHT 2
70 WINPR_API DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation);
71
72 WINPR_ATTR_NODISCARD
73 WINPR_API BOOL SetTimeZoneInformation(const TIME_ZONE_INFORMATION* lpTimeZoneInformation);
74
75 WINPR_ATTR_NODISCARD
76 WINPR_API BOOL SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime);
77
78 WINPR_ATTR_NODISCARD
79 WINPR_API BOOL FileTimeToSystemTime(const FILETIME* lpFileTime, LPSYSTEMTIME lpSystemTime);
80
81 WINPR_ATTR_NODISCARD
82 WINPR_API BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
83 LPSYSTEMTIME lpUniversalTime,
84 LPSYSTEMTIME lpLocalTime);
85
86 WINPR_ATTR_NODISCARD
87 WINPR_API BOOL TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,
88 LPSYSTEMTIME lpLocalTime,
89 LPSYSTEMTIME lpUniversalTime);
90
91#endif
92
93/*
94 * GetDynamicTimeZoneInformation is provided by the SDK if _WIN32_WINNT >= 0x0600 in SDKs above 7.1A
95 * and incorrectly if _WIN32_WINNT >= 0x0501 in older SDKs
96 */
97#if !defined(_WIN32) || \
98 (defined(_WIN32) && (defined(NTDDI_WIN8) && _WIN32_WINNT < 0x0600 || \
99 !defined(NTDDI_WIN8) && _WIN32_WINNT < 0x0501)) /* Windows Vista */
100
101 WINPR_API DWORD
102 GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation);
103
104 WINPR_ATTR_NODISCARD
105 WINPR_API BOOL
106 SetDynamicTimeZoneInformation(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation);
107
108 WINPR_ATTR_NODISCARD
109 WINPR_API BOOL GetTimeZoneInformationForYear(USHORT wYear, PDYNAMIC_TIME_ZONE_INFORMATION pdtzi,
111
112#endif
113
114#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0601)) /* Windows 7 */
115
116 WINPR_ATTR_NODISCARD
117 WINPR_API BOOL
118 SystemTimeToTzSpecificLocalTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation,
119 const SYSTEMTIME* lpUniversalTime, LPSYSTEMTIME lpLocalTime);
120
121 WINPR_ATTR_NODISCARD
122 WINPR_API BOOL
123 TzSpecificLocalTimeToSystemTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation,
124 const SYSTEMTIME* lpLocalTime, LPSYSTEMTIME lpUniversalTime);
125
126#endif
127
128#if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602)) /* Windows 8 */
129
130 WINPR_ATTR_NODISCARD
131 WINPR_API DWORD EnumDynamicTimeZoneInformation(
132 DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation);
133
134 WINPR_ATTR_NODISCARD
135 WINPR_API DWORD GetDynamicTimeZoneInformationEffectiveYears(
136 const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation, LPDWORD FirstYear,
137 LPDWORD LastYear);
138
139#else
140#pragma comment(lib, "advapi32")
141#endif
142
143#ifdef __cplusplus
144}
145#endif
146
147#endif /* WINPR_TIMEZONE_H */