FreeRDP
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
29 extern "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  WINPR_API BOOL SetTimeZoneInformation(const TIME_ZONE_INFORMATION* lpTimeZoneInformation);
72  WINPR_API BOOL SystemTimeToFileTime(const SYSTEMTIME* lpSystemTime, LPFILETIME lpFileTime);
73  WINPR_API BOOL FileTimeToSystemTime(const FILETIME* lpFileTime, LPSYSTEMTIME lpSystemTime);
74  WINPR_API BOOL SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION lpTimeZone,
75  LPSYSTEMTIME lpUniversalTime,
76  LPSYSTEMTIME lpLocalTime);
77  WINPR_API BOOL TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation,
78  LPSYSTEMTIME lpLocalTime,
79  LPSYSTEMTIME lpUniversalTime);
80 
81 #endif
82 
83 /*
84  * GetDynamicTimeZoneInformation is provided by the SDK if _WIN32_WINNT >= 0x0600 in SDKs above 7.1A
85  * and incorrectly if _WIN32_WINNT >= 0x0501 in older SDKs
86  */
87 #if !defined(_WIN32) || \
88  (defined(_WIN32) && (defined(NTDDI_WIN8) && _WIN32_WINNT < 0x0600 || \
89  !defined(NTDDI_WIN8) && _WIN32_WINNT < 0x0501)) /* Windows Vista */
90 
91  WINPR_API DWORD
92  GetDynamicTimeZoneInformation(PDYNAMIC_TIME_ZONE_INFORMATION pTimeZoneInformation);
93  WINPR_API BOOL
94  SetDynamicTimeZoneInformation(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation);
95  WINPR_API BOOL GetTimeZoneInformationForYear(USHORT wYear, PDYNAMIC_TIME_ZONE_INFORMATION pdtzi,
97 
98 #endif
99 
100 #if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0601)) /* Windows 7 */
101 
102  WINPR_API BOOL
103  SystemTimeToTzSpecificLocalTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation,
104  const SYSTEMTIME* lpUniversalTime, LPSYSTEMTIME lpLocalTime);
105  WINPR_API BOOL
106  TzSpecificLocalTimeToSystemTimeEx(const DYNAMIC_TIME_ZONE_INFORMATION* lpTimeZoneInformation,
107  const SYSTEMTIME* lpLocalTime, LPSYSTEMTIME lpUniversalTime);
108 
109 #endif
110 
111 #if !defined(_WIN32) || (defined(_WIN32) && (_WIN32_WINNT < 0x0602)) /* Windows 8 */
112 
113  WINPR_API DWORD EnumDynamicTimeZoneInformation(
114  const DWORD dwIndex, PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation);
115  WINPR_API DWORD GetDynamicTimeZoneInformationEffectiveYears(
116  const PDYNAMIC_TIME_ZONE_INFORMATION lpTimeZoneInformation, LPDWORD FirstYear,
117  LPDWORD LastYear);
118 
119 #else
120 #pragma comment(lib, "advapi32")
121 #endif
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
127 #endif /* WINPR_TIMEZONE_H */