예제 #1
0
        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);
        }
예제 #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);
        }
예제 #3
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);
        }
예제 #4
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;
        }
예제 #5
0
 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);
 }
예제 #6
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);
 }