HELPLIB.HLB  —  DECdts  utc_mkvmsanytime, Example
    The following example shows how to convert between OpenVMS format
    binary timestamps and UTC binary timestamps, while specifying the
    TDF for each. The TDF value determines the offset from GMT and
    the local time.

    /*****
     start example mkvmsanytime,vmsanytime
     *****/
    #include <utc.h>

    main()
    {
    struct utc utcTime;
    int vmsTime[2];

    SYS$GETTIM(vmsTime);    /* read the current time */

    /*
     * convert the VMS local time to a UTC, applying a TDF of
     * -300 minutes (the timezone is -5 hours from GMT)
     */
    if (utc_mkvmsanytime(&utcTime,vmsTime,-300))
        exit(1);

    /*
     * convert UTC back to VMS local time.  A TDF of -300 is applied
     * to the UTC, since utcTime was constructed with that same value.
     * This effectively gives us the same VMS time value we started
     * with.
     */
    if (utc_vmsanytime(vmsTime,&utcTime))
        exit(2);
    }
    /****
      end example
     ****/
Close Help