public void UpdateClockTimeZone(ref ClockInfo clockInfo, DateTime refDt, TimeZoneInfo refDtInfo) { var tzi = TimeZoneInfo.FindSystemTimeZoneById(clockInfo.TzId); if (tzi == null) { return; } clockInfo = CreateClockInfo(clockInfo.ClockId, tzi, refDt, refDtInfo); }
public void UpdateClockTime(ClockInfo clockInfo) { if (clockInfo?.TimeZoneInfo == null) { return; } clockInfo.Now = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, clockInfo.TimeZoneInfo); var timeTools = new TimeTools(); clockInfo.NowString = timeTools.TimeString(clockInfo.Now); }
private ClockInfo CreateClockInfo(string clockId, TimeZoneInfo timeZoneInfo, DateTime refDt, TimeZoneInfo refTimeZoneInfo) { var timeTools = new TimeTools(); var clockInfo = new ClockInfo(clockId, timeZoneInfo?.Id, refDt, refTimeZoneInfo?.Id); if (timeZoneInfo == null) { return(clockInfo); } clockInfo.TzName = timeZoneInfo.DisplayName; clockInfo.Now = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, timeZoneInfo); clockInfo.NowString = timeTools.TimeString(clockInfo.Now); return(clockInfo); }
private ClockInfo CreateClockInfo(string clockId, TimeZoneInfo timeZoneInfo, DateTime refDt, TimeZoneInfo refTimeZoneInfo) { var timeTools = new TimeTools(); var clockInfo = new ClockInfo(clockId, timeZoneInfo?.Id, refDt, refTimeZoneInfo?.Id); if (timeZoneInfo == null) { return clockInfo; } clockInfo.TzName = timeZoneInfo.DisplayName; clockInfo.Now = TimeZoneInfo.ConvertTime(DateTimeOffset.UtcNow, timeZoneInfo); clockInfo.NowString = timeTools.TimeString( clockInfo.Now); return clockInfo; }
public void UpdateClockTimeZone(ref ClockInfo clockInfo,DateTime refDt, TimeZoneInfo refDtInfo) { var tzi = TimeZoneInfo.FindSystemTimeZoneById(clockInfo.TzId); if (tzi == null) { return; } clockInfo = CreateClockInfo(clockInfo.ClockId, tzi, refDt, refDtInfo); }