Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions Parse/Internal/PlatformHooks/Phone/PlatformHooks.Phone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,12 @@ public string DeviceType {

public string DeviceTimeZone {
get {
// We need the system string to be in english so we'll have the proper key in our lookup table.
var culture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
string windowsName = TimeZoneInfo.Local.StandardName;
Thread.CurrentThread.CurrentCulture = culture;

if (ParseInstallation.TimeZoneNameMap.ContainsKey(windowsName)) {
return ParseInstallation.TimeZoneNameMap[windowsName];
} else {
return null;
}
TimeSpan utcOffset = TimeZoneInfo.Local.BaseUtcOffset;
return String.Format("GMT{0}{1}:{2:d2}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, shouldn't this be Etc/GMT{0}{1}..., or simply GMT{0}{1}... will work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me do a quick REST test and I'll let you know....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, you're correct, except our backend only supports Etc/GMT+1 (no minutes)... So maybe back to the drawing board. Damn.

offset.TotalSeconds < 0 ? "-" : "+",
Math.Abs(offset.Hours),
Math.Abs(offset.Minutes)
);
}
}

Expand Down
16 changes: 6 additions & 10 deletions Parse/Internal/PlatformHooks/Unity/PlatformHooks.Unity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,12 @@ public string DeviceType {

public string DeviceTimeZone {
get {
try {
string windowsName = TimeZoneInfo.Local.StandardName;
if (ParseInstallation.TimeZoneNameMap.ContainsKey(windowsName)) {
return ParseInstallation.TimeZoneNameMap[windowsName];
} else {
return null;
}
} catch (TimeZoneNotFoundException) {
return null;
}
TimeSpan utcOffset = TimeZoneInfo.Local.BaseUtcOffset;
return String.Format("GMT{0}{1}:{2:d2}",
offset.TotalSeconds < 0 ? "-" : "+",
Math.Abs(offset.Hours),
Math.Abs(offset.Minutes)
);
}
}

Expand Down