19 static string GetCurrentTimeZoneID()
21 return TimeZoneInfo.Local.Id;
30 static string MatchJavaTZ(
string javaHome,
string tzName)
34 var mapFileName = Path.Combine(javaHome,
"lib",
"tzmappings");
35 if (File.Exists(mapFileName) ==
false)
38 using var mapFile = File.OpenText(mapFileName);
39 string mapLine =
null;
40 while ((mapLine = mapFile.ReadLine()) !=
null)
42 mapLine = mapLine.Trim();
43 if (mapLine.Length < 4)
45 if (mapLine[0] ==
'#')
48 var l = mapLine.Split(
':');
83 var sp = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now);
88 else if (h >= 0 && m >= 0)
89 return $
"GMT+{h:D2}:{m:D2}";
91 return $
"GMT-{-h:D2}:{-m:D2}";
Implements the native methods for 'java.util.TimeZone'.
static string getSystemTimeZoneID(string javaHome)
Implements the native method 'getSystemTimeZoneID'.
static string getSystemGMTOffsetID()
Implements the native method 'getSystemGMTOffsetID'.
Maintains various information about the current runtime environment.
static bool IsWindows
Returns true if the current platform is Windows.