PreviousNext

utc_mkreltime(3dts)

Converts a tm structure that expresses relative time to a relative binary timestamp

Synopsis

#include <dce/utc.h>

int utc_mkreltime(
utc_t *utc,
struct tm *
timetm,
long
tns,
struct tm *
inacctm,
long
ins);

Parameters

Input

timetm
A tm structure that expresses a relative time. On input, tm_wday and tm_yday are ignored; the value of tm_isdst should be 1.

tns
Nanoseconds since the Time component.

inacctm
A tm structure that expresses seconds of inaccuracy. If a null pointer is passed, or if tm_yday is negative, the inaccuracy is considered to be unspecified. On input, tm_mday, tm_mon, tm_year, tm_wday, tm_isdst, and tm_zone are ignored.

ins
Nanoseconds of the inaccuracy component.

Output

utc
Resulting relative binary timestamp.

Description
The utc_mkreltime( ) routine converts a tm structure that expresses relative time to a relative binary timestamp. Additional inputs include nanoseconds since the last second of Time, and nanoseconds of inaccuracy.

Return Values
~0 Indicates that the routine executed successfully.

1 Indicates an invalid time argument or invalid results.

Examples
The following example converts the relative time: 125-03:12:30.1I120.25 to a relative binary timestamp.

utc_t utc;
struct tm tmtime,tminacc;
long tnsec,insec;
/* Fill in the fields
*/
memset((void *)&tmtime,0,sizeof(tmtime));
tmtime.tm_mday = 125;
tmtime.tm_hour = 3;
tmtime.tm_min = 12;
tmtime.tm_sec = 30;
tnsec = 100000000; /* .1 * 1.0E9 */
memset((void *)&tminacc,0,sizeof(tminacc));
tminacc.tm_sec = 120;
tnsec = 250000000; /* .25 * 1.0E9 */
/* Convert to a relative binary timestamp...
*/
utc_mkreltime(&utc, /* Out: Resultant relative binary timestamp */
&tmtime, /* In: tm struct that represents input */
tnsec, /* In: Nanoseconds from input */
&tminacc, /* In: tm struct that represents inacc */
insec); /* In: Nanoseconds from input */