View source code
Display the source code in std/datetime.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Struct std.datetime.Interval
Represents an interval of time.
An
has a starting point and an Interval
end
point. The interval of time
is therefore the time starting at the starting point up to, but not
including, the end
point. e.g.
A range can be obtained from an
, allowing iteration over
that interval, with the exact time points which are iterated over depending
on the function which generates the range.
Interval
Properties
Name | Type | Description |
---|---|---|
begin
[get]
|
TP |
The starting point of the interval. It is included in the interval. |
begin
[set]
|
TP |
The starting point of the interval. It is included in the interval. |
empty
[get]
|
bool |
Whether the interval's length is 0, that is, whether .
|
end
[get]
|
TP |
The end point of the interval. It is excluded from the interval.
|
end
[set]
|
TP |
The end point of the interval. It is excluded from the interval.
|
length
[get]
|
|
Returns the duration between and .
|
Methods
Name | Description |
---|---|
bwdRange
|
Returns a range which iterates backwards over the interval, starting
at , using func to generate each successive time
point.
|
contains
|
Whether the given time point is within this interval. |
contains
|
Whether the given interval is completely within this interval .
|
contains
|
Whether the given interval is completely within this interval .
|
contains
|
Whether the given interval is completely within this interval .
|
fwdRange
|
Returns a range which iterates forward over the interval, starting
at , using func to generate each successive time
point.
|
intersection
|
Returns the intersection of two intervals
|
intersection
|
Returns the intersection of two intervals
|
intersection
|
Returns the intersection of two intervals
|
intersects
|
Whether the given interval overlaps this interval .
|
intersects
|
Whether the given interval overlaps this interval .
|
intersects
|
Whether the given interval overlaps this interval .
|
isAdjacent
|
Whether the given interval is adjacent to this interval .
|
isAdjacent
|
Whether the given interval is adjacent to this interval .
|
isAdjacent
|
Whether the given interval is adjacent to this interval .
|
isAfter
|
Whether this interval is after the given interval and does not intersect
it.
|
isAfter
|
Whether this interval is after the given interval and does not intersect
it.
|
isAfter
|
Whether this interval is after the given time point. |
isAfter
|
Whether this interval is after the given interval and does not intersect
it.
|
isBefore
|
Whether this interval is before the given interval and does not
intersect with it.
|
isBefore
|
Whether this interval is before the given interval and does not
intersect with it.
|
isBefore
|
Whether this interval is before the given interval and does not
intersect with it.
|
isBefore
|
Whether this interval is before the given time point. |
merge
|
Returns the union of two intervals |
merge
|
Returns the union of two intervals |
merge
|
Returns the union of two intervals |
opAssign
|
|
span
|
Returns an interval that covers from the earliest time point of two
intervals up to (but not including) the latest time point of two
intervals.
|
span
|
Returns an interval that covers from the earliest time point of two
intervals up to (but not including) the latest time point of two
intervals.
|
span
|
Returns an interval that covers from the earliest time point of two
intervals up to (but not including) the latest time point of two
intervals.
|
toString
|
Converts this interval to a string. |
Templates
Name | Description |
---|---|
expand
|
Expands the interval forwards and/or backwards in time. Effectively,
it does and/or . Whether
it expands forwards and/or backwards in time is determined by
dir.
|
shift
|
Shifts the interval forward or backwards in time by the given duration
(a positive duration shifts the interval forward; a negative duration
shifts it backward). Effectively, it does and
.
|
this
|
|
this
|
Authors
Jonathan M Davis and Kato Shoichi