winpr: Updates time zones and fixes bias values
This commit is contained in:
parent
c5fd49c3a3
commit
16796b9c9d
@ -48,7 +48,7 @@ namespace TimeZones
|
|||||||
struct TIME_ZONE_ENTRY
|
struct TIME_ZONE_ENTRY
|
||||||
{
|
{
|
||||||
public string Id;
|
public string Id;
|
||||||
public UInt32 Bias;
|
public Int32 Bias;
|
||||||
public bool SupportsDST;
|
public bool SupportsDST;
|
||||||
public string DisplayName;
|
public string DisplayName;
|
||||||
public string StandardName;
|
public string StandardName;
|
||||||
@ -70,27 +70,13 @@ namespace TimeZones
|
|||||||
|
|
||||||
stream.WriteLine();
|
stream.WriteLine();
|
||||||
|
|
||||||
stream.WriteLine("struct _SYSTEM_TIME_ENTRY");
|
|
||||||
stream.WriteLine("{");
|
|
||||||
stream.WriteLine("\tuint16 wYear;");
|
|
||||||
stream.WriteLine("\tuint16 wMonth;");
|
|
||||||
stream.WriteLine("\tuint16 wDayOfWeek;");
|
|
||||||
stream.WriteLine("\tuint16 wDay;");
|
|
||||||
stream.WriteLine("\tuint16 wHour;");
|
|
||||||
stream.WriteLine("\tuint16 wMinute;");
|
|
||||||
stream.WriteLine("\tuint16 wSecond;");
|
|
||||||
stream.WriteLine("\tuint16 wMilliseconds;");
|
|
||||||
stream.WriteLine("};");
|
|
||||||
stream.WriteLine("typedef struct _SYSTEM_TIME_ENTRY SYSTEM_TIME_ENTRY;");
|
|
||||||
stream.WriteLine();
|
|
||||||
|
|
||||||
stream.WriteLine("struct _TIME_ZONE_RULE_ENTRY");
|
stream.WriteLine("struct _TIME_ZONE_RULE_ENTRY");
|
||||||
stream.WriteLine("{");
|
stream.WriteLine("{");
|
||||||
stream.WriteLine("\tuint64 TicksStart;");
|
stream.WriteLine("\tUINT64 TicksStart;");
|
||||||
stream.WriteLine("\tuint64 TicksEnd;");
|
stream.WriteLine("\tUINT64 TicksEnd;");
|
||||||
stream.WriteLine("\tsint32 DaylightDelta;");
|
stream.WriteLine("\tINT32 DaylightDelta;");
|
||||||
stream.WriteLine("\tSYSTEM_TIME_ENTRY StandardDate;");
|
stream.WriteLine("\tSYSTEMTIME StandardDate;");
|
||||||
stream.WriteLine("\tSYSTEM_TIME_ENTRY DaylightDate;");
|
stream.WriteLine("\tSYSTEMTIME DaylightDate;");
|
||||||
stream.WriteLine("};");
|
stream.WriteLine("};");
|
||||||
stream.WriteLine("typedef struct _TIME_ZONE_RULE_ENTRY TIME_ZONE_RULE_ENTRY;");
|
stream.WriteLine("typedef struct _TIME_ZONE_RULE_ENTRY TIME_ZONE_RULE_ENTRY;");
|
||||||
stream.WriteLine();
|
stream.WriteLine();
|
||||||
@ -98,13 +84,13 @@ namespace TimeZones
|
|||||||
stream.WriteLine("struct _TIME_ZONE_ENTRY");
|
stream.WriteLine("struct _TIME_ZONE_ENTRY");
|
||||||
stream.WriteLine("{");
|
stream.WriteLine("{");
|
||||||
stream.WriteLine("\tconst char* Id;");
|
stream.WriteLine("\tconst char* Id;");
|
||||||
stream.WriteLine("\tuint32 Bias;");
|
stream.WriteLine("\tINT32 Bias;");
|
||||||
stream.WriteLine("\tboolean SupportsDST;");
|
stream.WriteLine("\tBOOL SupportsDST;");
|
||||||
stream.WriteLine("\tconst char* DisplayName;");
|
stream.WriteLine("\tconst char* DisplayName;");
|
||||||
stream.WriteLine("\tconst char* StandardName;");
|
stream.WriteLine("\tconst char* StandardName;");
|
||||||
stream.WriteLine("\tconst char* DaylightName;");
|
stream.WriteLine("\tconst char* DaylightName;");
|
||||||
stream.WriteLine("\tTIME_ZONE_RULE_ENTRY* RuleTable;");
|
stream.WriteLine("\tTIME_ZONE_RULE_ENTRY* RuleTable;");
|
||||||
stream.WriteLine("\tuint32 RuleTableCount;");
|
stream.WriteLine("\tUINT32 RuleTableCount;");
|
||||||
stream.WriteLine("};");
|
stream.WriteLine("};");
|
||||||
stream.WriteLine("typedef struct _TIME_ZONE_ENTRY TIME_ZONE_ENTRY;");
|
stream.WriteLine("typedef struct _TIME_ZONE_ENTRY TIME_ZONE_ENTRY;");
|
||||||
stream.WriteLine();
|
stream.WriteLine();
|
||||||
@ -193,24 +179,13 @@ namespace TimeZones
|
|||||||
|
|
||||||
foreach (TimeZoneInfo timeZone in timeZones)
|
foreach (TimeZoneInfo timeZone in timeZones)
|
||||||
{
|
{
|
||||||
Int32 sbias;
|
|
||||||
TIME_ZONE_ENTRY tz;
|
TIME_ZONE_ENTRY tz;
|
||||||
TimeSpan offset = timeZone.BaseUtcOffset;
|
TimeSpan offset = timeZone.BaseUtcOffset;
|
||||||
|
|
||||||
rules = timeZone.GetAdjustmentRules();
|
rules = timeZone.GetAdjustmentRules();
|
||||||
|
|
||||||
tz.Id = timeZone.Id;
|
tz.Id = timeZone.Id;
|
||||||
|
tz.Bias = -(Int32)offset.TotalMinutes;
|
||||||
if (offset.Hours >= 0)
|
|
||||||
{
|
|
||||||
sbias = (offset.Hours * 60) + offset.Minutes;
|
|
||||||
tz.Bias = (UInt32) sbias;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sbias = (offset.Hours * 60) + offset.Minutes;
|
|
||||||
tz.Bias = (UInt32) (1440 + sbias);
|
|
||||||
}
|
|
||||||
|
|
||||||
tz.SupportsDST = timeZone.SupportsDaylightSavingTime;
|
tz.SupportsDST = timeZone.SupportsDaylightSavingTime;
|
||||||
|
|
||||||
@ -233,7 +208,7 @@ namespace TimeZones
|
|||||||
stream.WriteLine("\t{");
|
stream.WriteLine("\t{");
|
||||||
|
|
||||||
stream.WriteLine("\t\t\"{0}\", {1}, {2}, \"{3}\",",
|
stream.WriteLine("\t\t\"{0}\", {1}, {2}, \"{3}\",",
|
||||||
tz.Id, tz.Bias, tz.SupportsDST ? "true" : "false", tz.DisplayName);
|
tz.Id, tz.Bias, tz.SupportsDST ? "TRUE" : "FALSE", tz.DisplayName);
|
||||||
|
|
||||||
stream.WriteLine("\t\t\"{0}\", \"{1}\",", tz.StandardName, tz.DaylightName);
|
stream.WriteLine("\t\t\"{0}\", \"{1}\",", tz.StandardName, tz.DaylightName);
|
||||||
stream.WriteLine("\t\t{0}, {1}", tz.RuleTable, tz.RuleTableCount);
|
stream.WriteLine("\t\t{0}, {1}", tz.RuleTable, tz.RuleTableCount);
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user