예제 #1
0
        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;
        }
예제 #2
0
 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);
 }