VMS Help  —  DECdts  utc_mkbintime, Example
    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                */
Close Help