
[Top]
Calendar
Calendar.TimeRange
|
Method Calendar.TimeRange()->`-()
- Method
`-
object(TimeRange) Calendar.TimeRange()->`+(int n)
object(TimeRange) Calendar.TimeRange()->`+(object(TimeRange) offset)
object(TimeRange) Calendar.TimeRange()->`-(int m)
object(TimeRange) Calendar.TimeRange()->`-(object(TimeRange) x)
- Description
-
-
This calculates the (promoted) time period
either n step away or with a given offset.
These functions does use Calendar.TimeRange.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 Calendar.TimeRange.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.
Extracted from Pike v7.3 release 11 at 2001-11-03.
|