예제 #1
0
 public static DayTimeDurationValue Multiply(DayTimeDurationValue a, double b)
 {
     if (Double.IsNaN(b) || Double.IsNegativeInfinity(b) || Double.IsPositiveInfinity(b))
         throw new XQueryException(Properties.Resources.FOCA0005);
     long timespan = (long)(a.LowPartValue.Ticks * b);
     return new DayTimeDurationValue(new TimeSpan(timespan));
 }
예제 #2
0
 public static DayTimeDurationValue Divide(DayTimeDurationValue a, double b)
 {
     if (b == 0.0)
         throw new XQueryException(Properties.Resources.FOAR0001);
     if (Double.IsNaN(b))
         throw new XQueryException(Properties.Resources.FOCA0005);
     long timespan = (long)(a.LowPartValue.Ticks / b);
     return new DayTimeDurationValue(new TimeSpan(timespan));
 }
예제 #3
0
 public static TimeValue Add(TimeValue tm, DayTimeDurationValue duration)
 {
     DateTimeValue dat;
     if (tm.IsLocal)
         dat = new DateTimeValue(false, DateTime.Today, tm.Value.DateTime);
     else
         dat = new DateTimeValue(false, DateTime.Today, tm.Value.DateTime, tm.Value.Offset);
     DateTime dt = DateTimeValue.Add(dat, duration).Value.DateTime;
     DateTime today = DateTime.Today;
     dt = new DateTime(today.Year, today.Month, today.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond);
     if (tm.IsLocal)
         return new TimeValue(dt);
     else
         return new TimeValue(new DateTimeOffset(dt, tm.Value.Offset));
 }
예제 #4
0
        public static DateValue Add(DateValue dat, DayTimeDurationValue duration)
        {
            try
            {

                decimal seconds = (decimal)duration.LowPartValue.Ticks / TimeSpan.TicksPerSecond;
                decimal julian = dat.ToJulianInstant();
                julian += seconds;
                DateTimeValue dt = DateTimeValue.CreateFromJulianInstant(julian);
                if (dat.IsLocal)
                    return new DateValue(dt.S, dt.Value.Date);
                else
                    return new DateValue(dt.S, new DateTimeOffset(dt.Value.Date, dat.Value.Offset));
            }
            catch (ArgumentOutOfRangeException)
            {
                throw new XQueryException(Properties.Resources.FODT0001);
            }
        }
예제 #5
0
 private static decimal Divide(DayTimeDurationValue a, DayTimeDurationValue b)
 {
     if (b.LowPartValue == TimeSpan.Zero)
         throw new XQueryException(Properties.Resources.FOAR0001);
     return (decimal)a.LowPartValue.Ticks / (decimal)b.LowPartValue.Ticks;
 }
예제 #6
0
 public Proxy(DayTimeDurationValue value)
 {
     _value = value;
 }