VMS Help  —  DECdts  utc_mkvmslocaltime, Example
    The following example shows how to retrieve the current local
    time of the system in the binary OpenVMS format, convert the
    OpenVMS format time to a UTC-based binary timestamp (using the
    system's TDF), and print an ASCII representation of the binary
    timestamp.

1    /*********

   start example mkvmslocaltime
  *********/
 #include <utc.h>

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

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

 if (utc_mkvmslocaltime(&utcTime,vmsTime)) /* convert the local time */
     exit(1);                              /* vmsTime to UTC using   */
                                           /* the system tdf.        */

2    /* convert to ISO ascii*/

    utc_asclocaltime(outstring,UTC_MAX_STR_LEN,&utcTime);

3    /* format and print */

    printf("Current time=> %s\n",outstring);
 }

4    /*****

  end example
  *****/
Close Help