utc_mulftime(3dts)
Multiplies a relative binary timestamp by a floating-point value.
Synopsis
#include <dce/utc.h> int utc_mulftime( utc_t *result, utc_t *utc1,
double factor);
Parameters
Input
utc1 Relative binary timestamp. Use NULL if you want this routine to use the current time for this parameter.
factor Real scale factor (double-precision, floating-point value).
Output
result Resulting relative binary timestamp.
Description The utc_mulftime( ) routine multiplies a relative binary timestamp by a floating-point value. Either or both may be negative; the resulting relative binary
timestamp has the appropriate sign. The unsigned inaccuracy in the relative binary timestamp is also multiplied by the absolute value of the floating-point value.
Return Values ~0 Indicates that the routine executed successfully.
1 Indicates an invalid time argument or invalid results.
Examples The following example scales a relative time by a floating-point factor and prints the result.
utc_t relutc, scaledutc; struct tm scaledreltm; char timstr[UTC_MAX_STR_LEN]; /* Assume relutc contains the time to scale. */
utc_mulftime(&scaledutc, /* Out: Scaled rel time */ &relutc, /* In: Rel time to scale */ 17.65);
/* In: Scale factor */ utc_ascreltime(timstr, /* Out: ASCII rel time */ UTC_MAX_STR_LEN, /* In: Input
buffer length */ &scaledutc); /* In: Rel time to convert */ printf("%s\n",timstr);
/* Convert it to a tm structure and print it. */ utc_reltime(&scaledreltm, /* Out: Scaled rel tm */ (long *)0,
/* Out: Scaled rel nano-sec */ (struct tm *)0, /* Out: Scaled rel inacc tm */ (long *)0, /* Out: Scd rel inacc nanos */
&scaledutc); /* In: Rel time to convert */ printf("Approximately %d days, %d hours and %d minutes\n", scaledreltm.tm_yday,
scaledreltm.tm_hour, scaledreltm.tm_min);
Related Information Function: utc_multime(3dts)
|