示例#1
0
        public void SetDespawnTime()
        {
            //TODO: DST config option

            DespawnTime = DisappearTime.FromUnix();
            //if (TimeZoneInfo.Local.IsDaylightSavingTime(DespawnTime))
            //{
            //    DespawnTime = DespawnTime.AddHours(1); //DST
            //}
            SecondsLeft = DespawnTime.Subtract(DateTime.Now);

            FirstSeenTime = FirstSeen.FromUnix();
            //if (TimeZoneInfo.Local.IsDaylightSavingTime(FirstSeenTime))
            //{
            //    FirstSeenTime = FirstSeenTime.AddHours(1); //DST
            //}

            LastModifiedTime = LastModified.FromUnix();
            //if (TimeZoneInfo.Local.IsDaylightSavingTime(LastModifiedTime))
            //{
            //    LastModifiedTime = LastModifiedTime.AddHours(1);
            //}

            UpdatedTime = Updated.FromUnix();
            //if (TimeZoneInfo.Local.IsDaylightSavingTime(Updated))
            //{
            //    UpdatedTime = UpdatedTime.AddHours(1);
            //}
        }
示例#2
0
        /// <summary>
        /// Set despawn times because .NET doesn't support Unix timestamp deserialization to <seealso cref="DateTime"/> class by default.
        /// </summary>
        public void SetDespawnTime()
        {
            DespawnTime = DisappearTime.FromUnix();

            SecondsLeft = DespawnTime.Subtract(DateTime.Now);

            FirstSeenTime = FirstSeen.FromUnix();

            LastModifiedTime = LastModified.FromUnix();
        }
示例#3
0
        /// <summary>
        /// Set despawn times because .NET doesn't support Unix timestamp deserialization to <seealso cref="DateTime"/> class by default.
        /// </summary>
        public void SetDespawnTime()
        {
            DespawnTime = DisappearTime.FromUnix()
                          .ConvertTimeFromCoordinates(Latitude, Longitude);

            SecondsLeft = DespawnTime.Subtract(DateTime.UtcNow.ConvertTimeFromCoordinates(Latitude, Longitude));

            FirstSeenTime = FirstSeen
                            .FromUnix()
                            .ConvertTimeFromCoordinates(Latitude, Longitude);

            LastModifiedTime = LastModified
                               .FromUnix()
                               .ConvertTimeFromCoordinates(Latitude, Longitude);
        }