Given two (possibly unordered) binary timestamps, returns a single UTC time interval whose inaccuracy spans the two input binary timestamps. Format #include <utc.h> int utc_spantime(*result, *utc1, *utc2) utc_t *result; const utc_t *utc1; const utc_t *utc2;
1 – Parameters
Input utc1 Binary timestamp. utc2 Binary timestamp. Output result Spanning timestamp.
2 – Description
Given two binary timestamps, the Span Time routine returns a single UTC time interval whose inaccuracy spans the two input timestamps (that is, the interval resulting from the earliest possible time of either timestamp to the latest possible time of either timestamp).
3 – Notes
The tdf in the output UTC value is copied from the utc2 input. If either input binary timestamp has an infinite inaccuracy, an error is returned.
4 – Returns
0 Indicates that the routine executed successfully. -1 Indicates an invalid time argument.
5 – Example
The following example computes the earliest and latest times for an array of 10 timestamps. utc_t time_array[10], testtime, earliest, latest; int i; /* * Set the running timestamp to the first entry... */ testtime = time_array[0]; for (i=1; i<10; i++) { /* * Compute the minimum and the maximum against the next * element... */ utc_spantime(&testtime, /* Out: Resultant interval */ &testtime, /* In: Largest previous interval */ &time_array[i]); /* In: Element under test */ } /* * Compute the earliest possible time... */ utc_pointtime(&earliest, /* Out: Earliest poss time in array */ (utc_t *)0, /* Out: Midpoint */ &latest, /* Out: Latest poss time in array */ &testtime); /* In: Spanning interval */
6 – Related Functions
utc_boundtime, utc_gettime, utc_pointtime