Skip to content

Commit d80567b

Browse files
committed
analytics: Fix time zone parsinig.
1 parent 0ab957e commit d80567b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

LibDmd/Analytics.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ private static RudderContext CreateContext(string version, string runner)
172172
if (osVersion.IsNullOrEmpty()) {
173173
osVersion = OSVersion.GetOperatingSystem().ToString();
174174
}
175+
176+
string timezone = null;
177+
try {
178+
timezone = TimeZoneConverter.TZConvert.WindowsToIana(TimeZone.CurrentTimeZone.StandardName);
179+
} catch {
180+
Logger.Warn($"Could not parse time zone {TimeZone.CurrentTimeZone.StandardName}.");
181+
}
175182

176183
return new RudderContext {
177184
{ "app", new Dict {
@@ -195,7 +202,7 @@ private static RudderContext CreateContext(string version, string runner)
195202
{ "gpu_driver_date", ParseDate(sysInfo[FieldGpuDriverDate].ToString()) },
196203
} },
197204
{ "locale", CultureInfo.InstalledUICulture.Name },
198-
{ "timezone", TimeZoneConverter.TZConvert.WindowsToIana(TimeZone.CurrentTimeZone.StandardName) },
205+
{ "timezone", timezone },
199206
{ "os", new Dict {
200207
{ "name", osVersion },
201208
{ "version", $"{os.Version.Major}.{os.Version.Minor}.{os.Version.Build}" },

LibDmd/DmdDevice/DmdDevice.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@ public DmdDevice()
137137
if (_config.Global.SkipAnalytics) {
138138
Analytics.Instance.Disable();
139139
}
140-
Analytics.Instance.Init(_fullVersion, "DLL");
140+
141+
try {
142+
Analytics.Instance.Init(_fullVersion, "DLL");
143+
144+
} catch (Exception e) {
145+
Logger.Warn($"Error setting up analytics: {e.Message}");
146+
}
141147

142148
Logger.Info("Starting VPinMAME API {0} through {1}.exe.", _fullVersion,
143149
Process.GetCurrentProcess().ProcessName);

0 commit comments

Comments
 (0)