Download PDF Part II
Transcript
System Time Operations 27.2 Time Conversion and Date/Time Manipulation If you are programming in VAX MACRO, you can also specify approximate delta time values when you assemble a program, using two MACRO .LONG directives to represent a time value in 100-ns units. The arithmetic is based on the following formula: 1 second = 10 million * 100 ns For example, the following statement defines a delta time value of 5 seconds: FIVESEC: .LONG -10*1000*1000*5,-1 ; Five seconds The value 10 million is expressed as 10*1000*1000 for readability. Note that the delta time value is negative. If you use this notation, however, you are limited to the maximum number of 100-ns units that can be expressed in a longword. In time values this is slightly more than 7 minutes. 27.2.1.4 Obtaining Numeric and ASCII Time with SYS$NUMTIM The Convert Binary Time to Numeric Time (SYS$NUMTIM) system service converts a time in the system format into binary integer values. The service returns each of the components of the time (year, month, day, hour, and so on) into a separate word of a 7-word buffer. The SYS$NUMTIM system service and the format of the information returned are described in the OpenVMS System Services Reference Manual. You use the SYS$ASCTIM system service to format the time in ASCII for inclusion in an output string. The SYS$ASCTIM service accepts as an argument the address of a quadword that contains the time in system format and returns the date and time in ASCII format. If you want to include the date and time in a character string that contains additional data, you can format the output string with the Formatted ASCII Output (SYS$FAO) system service. The SYS$FAO system service converts binary values to ASCII representations, and substitutes the results in character strings according to directives supplied in an input control string. Among these directives are !%T and !%D, which convert a quadword time value to an ASCII string and substitute the result in an output string. For examples of how to do this, see the discussion of $FAO in the OpenVMS System Services Reference Manual. 27.2.2 Date/Time Manipulation Routines The run-time LIB$ facility provides several date/time manipulation routines. These routines let you add, subtract, and multiply dates and times. Use the LIB$ADDX and LIB$SUBX routines to add and subtract times, since the times are defined in integer arrays. Use LIB$ADD_TIMES and LIB$SUB_TIMES to add and subtract two quadword times. When manipulating delta times, remember that they are stored as negative numbers. For example, to add a delta time to an absolute time, you must subtract the delta time from the absolute time. Use LIB$MULT_DELTA_TIME and LIB$MULTF_DELTA_TIME to multiply delta times by scalar and floating scalar. Table 27–2 lists all the LIB$ routines that perform date/time manipulation. System Time Operations 27–7
Related documents
PDF Vol. II - Software Products Library
OpenVMS System Services Reference Manual: GETUTC–Z
HP Fortran for OpenVMS User Manual
Guide to OpenVMS File Applications
Model 4200-SCS Semiconductor Characterization System
POLYCENTER Software Installation Utility User`s Guide
OpenVMS System Manager`s Manual, Volume 2
DECdfs for OpenVMS Management Guide - OpenVMS Systems
C-ISAM Programmer`s Manual
Ada in Action
K1 SYSTEM K1 K1-SB
PDF Vol. II