陈嘉乐
2020-05-21 2fc1b7cbf8ae63ebc4b92fde4203317b7f3e0f33
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -38,7 +38,7 @@
        /// <summary>
        /// 时间戳
        /// </summary>
        public int timeLong = 0;
        public long timeLong = 0;
        public async void Show()
        {
@@ -81,7 +81,7 @@
                        //进来更新一次值
                        logicId = logic.LogicId;
                        timeValue = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]) / 3600;
                        timeLong = int.Parse(logic.Conditions[0]["TriggerTime"]);
                        timeLong = long.Parse(logic.Conditions[0]["TriggerTime"]);
                    }
                    catch { }
@@ -549,6 +549,7 @@
            {
                if (!SkipView.ExistLogic(logic, Send.CurrentDoorLock))
                {
                    ///不是该门锁自动化就不显示出来;
                    continue;
                }
                #region  自动化布局View
@@ -708,15 +709,22 @@
                };
            }
        }
        public DateTime GetLocalTime(int unixTimeStamp)
        /// <summary>
        /// 时间戳转换成时间格式
        /// </summary>
        /// <param name="unixTimeStamp">时间戳</param>
        /// <returns></returns>
        public DateTime GetLocalTime(long unixTimeStamp)
        {
            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            long lTime = long.Parse(unixTimeStamp + "0000000");
            TimeSpan toNow = new TimeSpan(lTime);
            DateTime dtResult = dtStart.Add(toNow);
            return dtResult;
            //DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            //long lTime = long.Parse(unixTimeStamp + "0000000");
            //TimeSpan toNow = new TimeSpan(lTime);
            //DateTime dtResult = dtStart.Add(toNow);
            //return dtResult;
            System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
            return startTime.AddMilliseconds(unixTimeStamp);
        }
    }
}