(LOGO.JPG) Python for OpenVMS

(go to: table of contents, index, list of vms_lib, prev: CURRENCY, next: CVTF_TO_INTERNAL_TIME)


CVTF_FROM_INTERNAL_TIME - Convert Internal Time to External Time (F-Floating-Point Value)


Format:
    resultant_time = vms_lib.cvtf_from_internal_time \
                         (operation, input_time)
Returns:
resultant_time
F-Floating-Point Value that results from the conversion.
Arguments:
operation
Conversion type to be performed. Codes (LIB$K_DELTA_xxx_F) are currently (24-OCT-1998) not available.
input_time
Delta time to be converted. 64-bit system time - a Python long integer.
See GENMAN 'Programming', 'special OpenVMS datatypes' for details.
Examples:
>>> import vms_lib

>>> # set up some constants
>>> LIB_K_DELTA_WEEKS_F   = 26
>>> LIB_K_DELTA_DAYS_F    = 27
>>> LIB_K_DELTA_HOURS_F   = 28
>>> LIB_K_DELTA_MINUTES_F = 29
>>> LIB_K_DELTA_SECONDS_F = 30

>>> op = LIB_K_DELTA_SECONDS_F
>>> import vms_sys
>>> q_deltim = vms_sys.bintim ('0 00:00:00.50')
>>> q_deltim
-5000000L
>>> resultant_time = vms_lib.cvtf_from_internal_time (op, q_deltim)
>>> resultant_time
0.5
>>>


>>> op = LIB_K_DELTA_DAYS_F
>>> q_deltim = vms_sys.bintim ('0 18:00:00.00')
>>> q_deltim
-648000000000L
>>> vms_lib.cvtf_from_internal_time (op, q_deltim)
0.749999940395        <-- @@ test on other versions
>>> print 18.0/24.0 #
0.75
>>>


>>> op = LIB_K_DELTA_DAYS_F
>>> q_deltim = vms_sys.bintim ('0 06:00:00.00')
>>> q_deltim
-216000000000L
>>> vms_lib.cvtf_from_internal_time (op, q_deltim)
0.25
>>> print 6.0/24.0 #
0.25
>>>


>>> vms_lib.cvtf_from_internal_time ('X', q_deltim)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation
>>>
>>> # -------------------------------v
>>> vms_lib.cvtf_from_internal_time (1, q_deltim)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (1410060, '%LIB-F-INVOPER, invalid operation specified')
>>>
>>> vms_lib.cvtf_from_internal_time (op, 'X')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: argument 2: input-time - must be long integer
>>>
>>> q_abstim = vms_sys.bintim ('29-FEB-2000 12:34:56.78')
>>> q_abstim
44585444967800000L
>>> vms_lib.cvtf_from_internal_time (op, q_abstim)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (1410052, '%LIB-F-DELTIMREQ, delta time required,\
 absolute time supplied')
>>>

(go to: table of contents, index, list of vms_lib, prev: CURRENCY, next: CVTF_TO_INTERNAL_TIME)

24-OCT-1998 ZE.