Change language

Python | time.get_clock_info () method

|

time.get_clock_info() in the Time module is used to get information about the specified clock name. This method returns information as a namespace object. 
The following are the supported clock names and the method used to read this clock value:

Syntax : time.get_clock_info (name)

Parameter:
name: A string value representing the clock name.

Return type: This method returns a namespace object whose attributes represents the information about specified clock name.
Following are the attributes of namespace object:

  • adjustable: This is ’True’ if the clock can be changed automatically or manually by the system administ rator. Otherwise ’False’.
  • implementation: The name of the underlying C function used to get the clock value.
  • monotonic: It’s value is true, if the clock can not go backward. Otherwise False.
  • resolution: This attribute specify the resolution of clock in seconds.

Code: using method time.get_clock_info()

# Python program to explain the time.get_clock_info () method

 
# module import time

import time

  
# Clock name

clock_name = ’clock’

  
# Get information about
# specified watch name

  clock_info = time.get_clock_info (clock_name)

 
# Print information

print ( "Information on’% s’: " % clock_name)

print (clock_info) 

 

clock_name = ’perf_counter’

  
# Get information about
# specified clock name

clock_info = time.get_clock_info (clock_name)

  
# Print information

print ( "Information on’% s’: " % clock_name)

print (clock_info) 

 

clock_name = process_time

  
# Get information about
# specified clock name

clock_info = time.get_clock_info (clock_name)

 
# Print information

print (< / code> "Information on’% s’: " % clock_name)

print (clock_info) 

Exit :

 Information on ’clock’: namespace (adjustable = False, implementation =’ clock () ’, monotonic = True, resolution = 1e-06) Information on ’perf_counter’: namespace (adjustable = False, implementation =’ clock_gettime (CLOCK_MONOTONIC) ’, monotonic = True, resolution = 1e-09) Information on’ process_time’: namespace (adjustable = False, implementation = ’clock_gettime (CLOCK_PROCESS_CPUTIME_ID)’, monotonic = True, resolution = 1e-09) 

Link: https://docs.python.org/3/library/time.html#time.get_clock_info

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically