Exemple #1
0
        /// <summary>
        /// Adds a timespan to this instance of DateTime
        /// </summary>
        /// <param name="timeSpan"></param>
        /// <returns></returns>
        public DateTime Add(TimeSpan timeSpan)
        {
            DateTime result = new DateTime(Universal.Add(timeSpan.ToSystemTimeSpan()), m_nanosecond,
                                           Type.TimeZone.UTC, true);

            result = result.AddMicrosecondsInternal(timeSpan.Microseconds);
            result = result.AddNanosecondsInternal(timeSpan.Nanoseconds);

            return(result.ToTimeZone(TimeZone));
        }
Exemple #2
0
        /// <summary>
        /// Adds microseconds to this instance of DateTime
        /// </summary>
        /// <param name="microseconds"></param>
        /// <returns></returns>
        public DateTime AddMicroseconds(double microseconds)
        {
            DateTime universal = ToUniversalTime();

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

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

            result = result.AddMicrosecondsInternal(whole);

            return(result.ToTimeZone(TimeZone));
        }