(PYVMS LOGO) Python on OpenVMS

(go to: table of contents, index, list of vms_lib, prev: CVT_FROM_INTERNAL_TIME, next: CVT_VECTIM)


CVT_TO_INTERNAL_TIME - Convert External Time to Internal Time


Format:
    resultant_time = vms_lib.cvt_to_internal_time \
                         (operation, input_time)
Returns:
resultant_time
OpenVMS internal format delta time that results from the conversion. 64-bit system time - a Python 'long integer'.
See GENMAN 'Programming', 'special OpenVMS datatypes' for details.
Arguments:
operation
Conversion type to be performed. Codes (LIB_K_DELTA_xxx_F) are currently (25-OCT-1998) not available.
input_time
Delta time to be converted. Python integer.
Examples:
>>> import vms_lib

>>> # set up some constants
>>> LIB_K_DELTA_WEEKS   = 21
>>> LIB_K_DELTA_DAYS    = 22
>>> LIB_K_DELTA_HOURS   = 23
>>> LIB_K_DELTA_MINUTES = 24
>>> LIB_K_DELTA_SECONDS = 25

>>> import vms_sys

>>> op = LIB_K_DELTA_SECONDS
>>> q_restim = vms_lib.cvt_to_internal_time (op, 5)
>>> q_restim
-50000000L
>>> vms_sys.asctim (q_restim)
'   0 00:00:05.00'
>>>


>>> op = LIB_K_DELTA_MINUTES
>>> q_restim = vms_lib.cvt_to_internal_time (op, 127)
>>> q_restim
-76200000000L
>>> vms_sys.asctim (q_restim)
'   0 02:07:00.00'
>>>


>>> op = LIB_K_DELTA_HOURS
>>> q_restim = vms_lib.cvt_to_internal_time (op, 25)
>>> q_restim
-900000000000L
>>> vms_sys.asctim (q_restim)
'   1 01:00:00.00'
>>>


>>> op = LIB_K_DELTA_DAYS
>>> q_restim = vms_lib.cvt_to_internal_time (op, 123)
>>> q_restim
-106272000000000L
>>> vms_sys.asctim (q_restim)
' 123 00:00:00.00'
>>>


>>> # more than 9999 days of delta-time are prevented
>>> q_restim = vms_lib.cvt_to_internal_time (op, 10000)
>>> q_restim
-8640000000000000L
>>> vms_sys.asctim (q_restim)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_sys.error: (388, '%SYSTEM-F-IVTIME, invalid time')
>>>


>>> q_restim = vms_lib.cvt_to_internal_time (1,1)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (1410060, '%LIB-F-INVOPER, invalid operation specified')
>>>

>>> vms_lib.cvt_to_internal_time ('X', 1)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation
>>>

>>> vms_lib.cvt_to_internal_time (op, 'X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation
>>>

(go to: table of contents, index, list of vms_lib, prev: CVT_FROM_INTERNAL_TIME, next: CVT_VECTIM)

25-OCT-1998 ZE.