Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ utc_mkbintime(3dts) — DCE 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

utc_mkbintime(3dts)  —  Subroutines

Name

utc_mkbintime - Converts a timespec structure to a binary timestamp

Synopsis

#include <dce/utc.h> int utc_mkbintime(
utc_t ∗utc,
timespec_t ∗timesp,
timespec_t ∗inaccsp,
long tdf);

Parameters

Input

timespA timespec structure that expresses time since 1970−01−01:00:00:00.0+00:00I0. 

inaccspA timespec structure that expresses inaccuracy.  If a null pointer is passed, or if tv_sec is set to a value of -1, the inaccuracy is considered to be unspecified. 

tdfTDF component of the binary timestamp. 

Output

utcResulting binary timestamp. 

Description

The utc_mkbintime() routine converts a timespec structure time to a binary timestamp.  The TDF input is used as the TDF of the binary timestamp. 

Return Values

 0Indicates that the routine executed successfully. 

-1Indicates an invalid time argument or invalid results. 

Examples

The following example obtains the current time from time(3), converts it to a binary timestamp with an inaccuracy of 5.2 seconds, and specifies GMT. 

timespec_t   ttime, tinacc;
utc_t        utc;
 /∗   Obtain the current time (without the inaccuracy)...
 ∗/
 ttime.tv_sec = time((time_t ∗)0);
ttime.tv_nsec = 0;
 /∗   Specify the inaccuracy...
 ∗/
 tinacc.tv_sec = 5;
tinacc.tv_nsec = 200000000;
 /∗   Convert to a binary timestamp...
 ∗/
 utc_mkbintime(&utc,       /∗ Out: Binary timestamp          ∗/
              &ttime,     /∗ In:  Current time in timespec  ∗/
              &tinacc,    /∗ In:  5.2 seconds in timespec   ∗/
              0);         /∗ In:  TDF of GMT                ∗/

Related Information

Functions: utc_bintime(3dts), utc_mkbinreltime(3dts). 

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026