feat: Add method to IcdEnvironment to get the name of the local time zone

This commit is contained in:
Austin Noska
2021-02-18 16:18:38 -05:00
parent 456a8f74f9
commit 4ff4e9f3c6
2 changed files with 20 additions and 0 deletions

View File

@@ -210,6 +210,15 @@ namespace ICD.Common.Utils
#region Methods
/// <summary>
/// Gets the name of the local time zone.
/// </summary>
/// <returns></returns>
public static string GetLocalTimeZoneName()
{
return CrestronEnvironment.GetTimeZone().Name;
}
public static DateTime GetLocalTime()
{
return CrestronEnvironment.GetLocalTime();

View File

@@ -93,6 +93,17 @@ namespace ICD.Common.Utils
s_CrestronRuntimeEnvironment = eCrestronRuntimeEnvironment.Na;
}
/// <summary>
/// Gets the name of the local time zone.
/// </summary>
/// <returns></returns>
public static string GetLocalTimeZoneName()
{
return System.TimeZoneInfo.Local.IsDaylightSavingTime(GetLocalTime())
? System.TimeZoneInfo.Local.DaylightName
: System.TimeZoneInfo.Local.StandardName;
}
public static DateTime GetLocalTime()
{
return DateTime.Now;