Library /sys$common/syshlp/helplib.hlb  —  DECdts  utc_addtime, Example
    The following example shows how to compute a timestamp that
    represents a time at least 5 seconds in the future.

    utc_t               now, future, fivesec;
    reltimespec_t       tfivesec;
    timespec_t          tzero;

    /*
     *   Construct a timestamp that represents 5 seconds...
     */
    tfivesec.tv_sec = 5;
    tfivesec.tv_nsec = 0;
    tzero.tv_sec = 0;
    tzero.tv_nsec = 0;
    utc_mkbinreltime(&fivesec, /* Out: 5 secs in binary timestamp */
                    &tfivesec, /* In:  5 secs in timespec         */
                    &tzero);   /* In:  0 secs inaccuracy in timespec */

    /*
     *  Get the maximum possible current time...
     *  (NULL input parameter is used to specify the current time.)
     */
    utc_pointtime((utc_t *)0, /* Out: Earliest possible current time */
                 (utc_t *)0, /* Out: Midpoint of current time       */
                 &now,       /* Out: Latest possible current time   */
                 (utc_t *)0);/* In:  Use current time               */

    /*
     *   Add 5 seconds to get future timestamp...
     */
    utc_addtime(&future,     /* Out: Future binary timestamp        */
                &now,        /* In:  Latest possible time now       */
                &fivesec);   /* In:  5 secs                         */
Close Help