Exemplo n.º 1
0
        internal NpgsqlDate Add(NpgsqlTimeSpan interval, int carriedOverflow)
        {
            switch (_type)
            {
            case InternalType.Infinity:
                return(Infinity);

            case InternalType.NegativeInfinity:
                return(NegativeInfinity);

            case InternalType.Finite:
                break;

            default:
                throw new InvalidOperationException($"Internal Npgsql bug: unexpected value {_type} of enum {nameof(NpgsqlDate)}.{nameof(InternalType)}. Please file a bug.");
            }

            return(AddMonths(interval.Months).AddDays(interval.Days + carriedOverflow));
        }
Exemplo n.º 2
0
 public NpgsqlDateTime Subtract(NpgsqlTimeSpan interval)
 {
     return(Add(-interval));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns a new <see cref="NpgsqlDateTime"/> that adds the value of the specified TimeSpan to the value of this instance.
 /// </summary>
 /// <param name="value">A positive or negative time interval.</param>
 /// <returns>An object whose value is the sum of the date and time represented by this instance and the time interval represented by value.</returns>
 public NpgsqlDateTime Add(NpgsqlTimeSpan value)
 {
     return(AddTicks(value.Ticks));
 }
Exemplo n.º 4
0
 public NpgsqlDate Subtract(NpgsqlTimeSpan interval) => Add(-interval);