예제 #1
0
파일: DateTime.cs 프로젝트: formist/LinkMe
        /// <summary>
        /// Adds milliseconds to this instance of DateTime
        /// </summary>
        /// <param name="milliseconds"></param>
        /// <returns></returns>
        public DateTime AddMilliseconds(double milliseconds)
        {
            DateTime universal = ToUniversalTime();

            double whole      = System.Math.Floor(milliseconds);
            double fractional = milliseconds - whole;

            DateTime result = universal.AddNanosecondsInternal
                                  (fractional * DateTimeHelper.Milliseconds2Nanoseconds);

            result = result.AddMillisecondsInternal(whole);

            return(result.ToTimeZone(TimeZone));
        }
예제 #2
0
파일: DateTime.cs 프로젝트: formist/LinkMe
        /// <summary>
        /// Adds nanoseconds to this instance of DateTime
        /// </summary>
        /// <param name="nanoseconds"></param>
        /// <returns></returns>
        private DateTime AddNanosecondsInternal(double nanoseconds)
        {
            double carry;
            int    newValue = DateTimeHelper.AddPlaceValues(m_nanosecond, nanoseconds,
                                                            DateTimeHelper.Milliseconds2Nanoseconds, out carry);

            DateTime result = new DateTime(m_base, newValue, Type.TimeZone.UTC, true);

            if (carry == 0)
            {
                return(result);
            }
            else
            {
                return(result.AddMillisecondsInternal(carry));
            }
        }