NAME
utc_abstime - Computes the absolute value of a relative binary
timestamp
SYNOPSIS
#include <dce/utc.h>
int utc_abstime( utc_t* result,
utc_t *utc );
PARAMETERS
Input
utc
Relative binary timestamp. Use NULL if you want this routine to
use the current time for this parameter.
Output
result
Absolute value of the input relative binary timestamp.
DESCRIPTION
The utc_abstime() routine computes the absolute value of a relative
binary timestamp. The input timestamp represents a relative (delta)
time.
RETURN VALUES
0 Indicates that the routine executed successfully.
-1 Indicates an invalid time parameter or invalid results.
EXAMPLES
The following example scales a relative time, computes its absolute
value, and prints the result.
utc_t relutc, scaledutc;
char timstr[UTC_MAX_STR_LEN];
/* Make sure relative timestamp represents a positive interval... */
utc_abstime(&relutc, /* Out: Abs-value of rel time */
&relutc); /* In: Relative time to scale */
/* Scale it by a factor of 17... */
utc_multime(&scaledutc, /* Out: Scaled relative time */
&relutc, /* In: Relative time to scale */
17L); /* In: Scale factor */
utc_ascreltime(timstr, /* Out: ASCII relative time */
UTC_MAX_STR_LEN, /* In: Length of input string */
&scaledutc); /* In: Relative time to */
/* convert */
printf("%s\n",timstr);
/* Scale it by a factor of 17.65... */
utc_mulftime(&scaledutc, /* Out: Scaled relative time */
&relutc, /* In: Relative time to scale */
17.65); /* In: Scale factor */
utc_ascreltime(timstr, /* Out: ASCII relative time */
UTC_MAX_STR_LEN, /* In: Length of input string */
&scaledutc); /* In: Relative time to */
/* convert */
printf("%s\n",timstr);