Library /sys$common/syshlp/helplib.hlb  —  DECdts  utc_mkvmslocaltime
    Converts a local binary OpenVMS format time to a binary
    timestamp, using the host system's time differential factor.

    Format

      #include <utc.h>

      int utc_mkvmslocaltime(*utc, *timadr)

         const long *timadr;
         utc_t *utc;

1  –  Parameters

    Input

 *timadr

    Binary OpenVMS format time expressing local time.

    Output

 *utc

    Binary timestamp expressing the system's local time.

2  –  Description

    The Make VMS Local Time routine converts a binary OpenVMS format
    time, representing the local time of the host system, to a binary
    timestamp. The system's local time value is defined by the time
    zone rule in sys$timezone_rule, which is created by the system
    configuration process sys$manager:net$configure.com.

3  –  Notes

    If the routine call is made during a seasonal time zone change
    when the local time is indeterminate, an error is returned. For
    example, if the time zone change occurs at the current local time
    of 2:00 A.M. to a new local time of 1:00 A.M., and the routine is
    called between 1:00 A.M. and 2:00 A.M., it cannot be determined
    which TDF applies.

4  –  Returns

     0   Indicates that the routine executed successfully.
    -1   Indicates an invalid time argument, invalid results, or
         invalid routine call during a time zone change.

5  –  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.

5.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.        */

5.2    /* convert to ISO ascii*/

    utc_asclocaltime(outstring,UTC_MAX_STR_LEN,&utcTime);

5.3    /* format and print */

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

5.4    /*****

  end example
  *****/

6  –  Related Functions

    Function: utc_vmslocaltime
Close Help