Skip to content

Commit

Permalink
[cmake,utils]
Browse files Browse the repository at this point in the history
  • Loading branch information
akallabeth committed Apr 26, 2024
1 parent a4010c7 commit 38fcf6a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions winpr/libwinpr/timezone/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project(tzextract VERSION 1.0.0 LANGUAGES CSharp)

add_executable(${PROJECT_NAME}
tzextract.cs
)
38 changes: 38 additions & 0 deletions winpr/libwinpr/timezone/utils/tzextract.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Text;

internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("/* Automatically generated by tzextract */");
Console.WriteLine("");
Console.WriteLine("#include \"TimeZoneNameMap.h\"");
Console.WriteLine("");
Console.WriteLine("const TimeZoneNameMapEntry TimeZoneNameMap[] ={");

foreach (TimeZoneInfo tz in TimeZoneInfo.GetSystemTimeZones())
{
string iana;
TimeZoneInfo.TryConvertWindowsIdToIanaId(tz.Id, out iana);

StringBuilder sb = new StringBuilder();
sb.Append("{ \"");
sb.Append(tz.Id);
sb.Append("\", \"");
sb.Append(tz.StandardName);
sb.Append("\", \"");
sb.Append(tz.DisplayName);
sb.Append("\", \"");
sb.Append(tz.DaylightName);
sb.Append("\", \"");
sb.Append(iana);
sb.Append("\" },");
Console.WriteLine(sb.ToString());
}

Console.WriteLine("};");
Console.WriteLine("");
Console.WriteLine("const size_t TimeZoneNameMapSize = ARRAYSIZE(TimeZoneNameMap);");
Console.WriteLine("");
}
}

0 comments on commit 38fcf6a

Please sign in to comment.