Computes the difference between two binary timestamps that
express either an absolute time and a relative time, two relative
times, or two absolute times.
Format
#include <utc.h>
int utc_subtime(*result, *utc1, *utc2)
utc_t *result;
const utc_t *utc1;
const utc_t *utc2;
1 – Parameters
Input
utc1
Binary timestamp or relative binary timestamp.
utc2
Binary timestamp or relative binary timestamp.
Output
result
Resulting binary timestamp or relative binary timestamp,
depending on the operation performed:
o absolute time - absolute time = relative time
o relative time - relative time = relative time
o absolute time - relative time = absolute time
o relative time - absolute time is undefined. See NOTES.
2 – Description
The Subtract Time routine subtracts one binary timestamp
from another. The resulting timestamp is utc1 minus utc2.
The inaccuracies of the two input timestamps are combined and
included in the output timestamp. The TDF in the first timestamp
is copied to the output.
3 – Notes
Although no error is returned, do not use the combination
relative time - absolute time.
4 – Returns
0 Indicates that the routine executed successfully.
-1 Indicates an invalid time argument or invalid results.
5 – Example
See the sample program for the utc_binreltime routine.
6 – Related Functions
utc_addtime