HELPLIB.HLB  —  DCE  DCE_DTS, Application Routines, utc_mkbintime
 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

   timesp
          A timespec structure that expresses time since
          1970-01-01:00:00:00.0+0:00I0.

   inaccsp
          A 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.

   tdf    TDF component of the binary timestamp.

   Output

   utc    Resulting 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

    0    Indicates that the routine executed successfully.

   -1    Indicates an invalid time argument or invalid results.

 EXAMPLES

   The following example obtains the current time from time(), 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
              utc_mkbinreltime
Close Help