Calculates the difference of time series in seconds.
TIMEDURATION(time1, time2)
time1 |
- |
A series of time of day values, the end time. |
time2 |
- |
Optional. A series of time of day values, the start time. Defaults to an empty series. |
A series, the elapsed duration in seconds.
If only one time series is specified, the durations are computed on the two-point difference of each time value.
W1: hms2time(10, 11, 12)
W2: hms2time(20, 30, 40)
W3: timeduration(w2, w1)
W4: timeoffset(w1, seconds:w3)
W1 contains the time:
10:11:12
W2 contains the time:
20:30:40
W3 computes difference between the two time series in seconds. The duration is 37168 seconds.
W4 reconstructs W2's end time by adding W3's offset (in seconds) to W1's start time.
W1: hms2time(10, 11, 12)
W2: hms2time(20, 30, 40)
W3: timeduration(w1, w2)
W4: timeoffset(w2, seconds:w3)
Same as the first example except the start and end times are swapped. The result is a negative duration of -37168 seconds.
W4 reconstructs W1's original end time by applying the negative offset from W3 to W2's recorded start time. Specifically, W4 adds this offset to W2's start time, shifting it backward to derive W1's end time.
W1: gnorm(10, 1.005)
W2: col(getdt(w1), 2)
W3: timeduration(w2)
W4: w3;setvunits("Real Time")
W1 contains 10 random samples with a time spacing of 1.005 seconds between samples.
W2 computes the time values for each sample in W1.
Because only one
time series input was given, W3 computes the
W4 displays the time differences contained in W3 in wall-clock format.
TIMEDURATION computes the difference between two time series with the result a duration in seconds.
If only one time series is provided, the two-point difference between subsequent time values is computed.
A time duration is measured in seconds.
A time period is measured in years, months and days.
See TIMEPERIOD to compute the time difference in hours, minutes and seconds.