| Extracted from Pike v7.8 release 866 at 2018-07-18.

[Top]
Calendar
Calendar.TimeRange

# Method Calendar.TimeRange()->`-()

Method `-

  `TimeRange `+(int n)`
  `TimeRange `+(TimeRange offset)`
  `TimeRange `-(int m)`
  `TimeRange `-(TimeRange x)`

Description

  This calculates the (promoted) time period either n step away or with a given offset. These functions does use add to really do the job:

      t+n         t->add(n)             t is a time period
      t-n         t->add(-n)            offset is a time period
      t+offset    t->add(1,offset)      n is an integer
      t-offset    t->add(-1,offset)
      n+t         t->add(n)
      n-t         illegal
      offset+t    offset->add(1,t)      | note this!
      offset-t    offset->add(-1,t)     |

  Mathematic rules:

      x+(t-x) == t    x is an integer or a time period
      (x+t)-x == t    t is a time period
      (t+x)-x == t
      o-(o-t) == t    o is a time period
      t++ == t+1
      t-- == t-1

Note

  a-b does not give the distance between the start of a and b. Use the distance () function to calculate that.

  The integer used to `+, `- and add are the number of steps the motion will be. It does never represent any fixed amount of time, like seconds or days.