Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ utc_abstime(3dts) — DCE 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

utc_abstime(3dts)  —  Subroutines

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

utcRelative binary timestamp.  Use NULL if you want this routine to use the current time for this parameter. 

Output

resultAbsolute 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

 0Indicates that the routine executed successfully. 

-1Indicates 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);

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