(PYVMS LOGO) Python on OpenVMS

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


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


Format:
    resultant_time = vms_lib.cvtf_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 (24-OCT-1998) not available.
input_time
Delta time to be converted (F-Floating-Point value).
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
>>> resultant_time = vms_lib.cvtf_to_internal_time (op, 0.5)
>>> resultant_time
-5000000L
>>> vms_sys.asctim (resultant_time)
'   0 00:00:00.50'
>>>


>>> op = LIB_K_DELTA_DAYS_F
>>> print 8.0/24.0
0.333333333333
>>> resultant_time = vms_lib.cvtf_to_internal_time (op, 8.0/24.0)
-287999971200L
>>> vms_sys.asctim (resultant_time)
'   0 07:59:59.99'
>>>


>>> op = LIB_K_DELTA_DAYS_F
>>> print 6.0/24.0
0.25
>>> resultant_time = vms_lib.cvtf_to_internal_time (op, 6.0/24.0)
>>> resultant_time
-216000000000L
>>> vms_sys.asctim (resultant_time)
'   0 06:00:00.00'
>>>


>>> # a week has 7 days. 0.5 week = 3.5 days = 3 days, 12 hours
>>> op = LIB_K_DELTA_WEEKS_F
>>> resultant_time = vms_lib.cvtf_to_internal_time (op, 0.5)
>>> resultant_time
-3024000000000L
>>> vms_sys.asctim (resultant_time)
'   3 12:00:00.00'
>>>


>>> vms_lib.cvtf_to_internal_time ('X', 0.5)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
TypeError: illegal argument type for built-in operation
>>>
>>> # -----------------------------v
>>> vms_lib.cvtf_to_internal_time (1, 0.5)
Traceback (innermost last):
  File "<stdin>", line 1, in ?
vms_lib.error: (1410060, '%LIB-F-INVOPER, invalid operation specified')
>>>
>>> vms_lib.cvtf_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: CVTF_FROM_INTERNAL_TIME, next: CVT_FROM_INTERNAL_TIME)

24-OCT-1998 ZE.