A timespan is internally represented entirely in arbitrary base units, currently defined as milliseconds. A timespan is a pair of values, one defining the bottom end of the interval, the other the top end. The bottom interval is always closed, the top end is always open: [bottom, top).
Timespans may be absolute, or relative to the current time.
Relative timespans have values for 'lo' and 'hi' given in seconds relative to "now." Absolute timespans have values for 'lo' and 'hi' relative to the Unix Epoch.
If
Represents an extent in time bounded by begin and end dateTimes.
The dateTime is defined according to XML Schema time (see XML Schema Part 2: Datatypes Second Edition). The value can be expressed as yyyy-mm-ddThh:mm:sszzzzzz, where T is the separator between the date and the time, and the time zone is either Z (for UTC) or zzzzzz, which represents ±hh:mm in relation to UTC. Additionally, the value can be expressed as a date only. See
<TimeSpan id="ID"> <begin>...</begin> <!-- kml:dateTime --> <end>...</end> <!-- kml:dateTime --> </TimeSpan>Extends: @see :
Time spans are expressed as a combination of time units and their associated amounts. Each amount may add up to be more than one of a larger time unit. For example a time unit may be expressed as 1 month and 6 weeks. Time amounts that are not used should be set to 0, e.g. a time span representing a single day would have only {@code days} set to 1 and all other time units as0.
Note that when the overloaded {@code Date} and {@code long} methods are used,the instances are converted to the JVM's current calendar system. This may have a slight, noticeable affect due to daylight savings or any other calendar-specific differences to how a date is calculated. @see Calendar @see Date
Note that the largest value you can represent with this class is 9223372036854775807 (Long.MAX_VALUE
), or equivalently, 292471208 yrs 247 days 7 hrs 12 min 55.807 sec. Overflow is not handled gracefully by this class.
Also note that for the purposes of this class, a year has 365 days. I.e., a year corresponds to 365 * 24 * 60 * 60 * 1000
ms.
Instances of this class are immutable.
TODO: Support for negative time spans. @author Johannes Rössel @see System#nanoTime()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|