Python for OpenVMS
(go to: table of contents,
index,
list of vms_lib,
prev: SET_SYMBOL,
next: TRIM_FILESPEC)
SUB_TIMES - Subtract Two Quadword Times
Format:
resultant_time = vms_lib.sub_times (time1, time2)
Returns:
- resultant_time
- The result of subtracting time2 from time1.
64-bit system time - a Python long integer.
See GENMAN 'Programming',
'special OpenVMS datatypes'
for details.
Arguments:
- time1
- First time, from which LIB$SUB_TIMES subtracts the second time.
64-bit system time - a Python long integer.
See GENMAN 'Programming',
'special OpenVMS datatypes'
for details.
- time2
- Second time, which LIB$SUB_TIMES subtracts from the first time.
64-bit system time - a Python long integer.
See GENMAN 'Programming',
'special OpenVMS datatypes'
for details.
Examples:
>>> import vms_lib
>>> import vms_sys # needed for ascii/integer conversion
>>> time1 = vms_sys.bintim ('29-FEB-2000 12:34:56.78')
>>> print time1
44585444967800000L
>>> time2 = vms_sys.bintim ('0 01:02:03.11')
>>> print time2
-37231100000L
>>> time3 = vms_sys.bintim ('01-JAN-2000 12:56:34.89')
>>> print time3
44534481948900000L
>>> time4 = vms_sys.bintim ('0 04:03:02.11')
>>> print time4
-145821100000L
>>> resultant_time = vms_lib.sub_times (time1, time2)
>>> print resultant_time, vms_sys.asctim (resultant_time);
44585407736700000L 29-FEB-2000 11:32:53.67
>>> resultant_time = vms_lib.sub_times (time1, time3)
>>> print resultant_time, vms_sys.asctim (resultant_time);
-50963018900000L 58 23:38:21.89
>>> resultant_time = vms_lib.sub_times (time4, time2)
>>> print resultant_time, vms_sys.asctim (resultant_time);
-108590000000L 0 03:00:59.00
>>> resultant_time = vms_lib.sub_times (time2, time1)
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_lib.error: (1410036, '%LIB-F-INVARGORD, invalid argument order')
>>>
>>> resultant_time = vms_lib.sub_times (time2, time4)
Traceback (innermost last):
File "<stdin>", line 1, in ?
vms_lib.error: (1410028, '%LIB-F-NEGTIM, a negative time was computed')
>>>
>>> resultant_time = vms_lib.sub_times (time1, time1)
>>> print resultant_time, vms_sys.asctim (resultant_time);
-1L 0 00:00:00.00
* Note: VMS cannot express a delta-time of '0 00:00:00.00'.
This is really a delta time of 100 nanoseconds!
>>> resultant_time = vms_lib.sub_times (time2, time2)
>>> print resultant_time, vms_sys.asctim (resultant_time);
-1L 0 00:00:00.00
* Note: VMS cannot express a delta-time of '0 00:00:00.00'.
This is really a delta time of 100 nanoseconds!
>>> resultant_time = vms_lib.sub_times ('X', time2)
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 1: must be long integer
>>>
>>> resultant_time = vms_lib.sub_times (time1, 'X')
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 2: must be long integer
>>>
>>> resultant_time = vms_lib.sub_times ()
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: function requires exactly 2 arguments; 0 given
>>>
>>> resultant_time = vms_lib.sub_times (time1, 2)
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: argument 2: must be long integer
>>>
(go to: table of contents,
index,
list of vms_lib,
prev: SET_SYMBOL,
next: TRIM_FILESPEC)
30-SEP-1998 ZE.