25. Time Module : Python

Time Module

Time can be followed through its underlying libraries. The time module comprises ever-related capacities. It likewise permits us to get to a few kinds of tickers needed for different purposes.


time.time() - It returns us the seconds that have passed since the Unix age. In basic words, it lets us know the time in seconds that have passed since 1 January 1970. Its language structure is straightforward to utilize.


Time. rest() -

  • It defers the execution of additional orders for given explicit seconds. In basic terms, it sends the program to rest for some characterized number of seconds.
  • It is for the most part utilized in programs straightforwardly associated with the working framework and in-game turn of events. It stops the program execution, allowing different projects an opportunity to get executed all the while.


Time Localtime() -

  • It is utilized to change the number of seconds over to neighborhood time. This capacity requires seconds as a boundary and returns the date and time in time.struct_time design.
  • It is discretionary to pass seconds as a boundary. If seconds are not given, the current time will be returned by time() is utilized.


Employments of time modules -

  • In games where missions rely upon a specific time limit.
  • To check the execution time a specific piece of our code is taking.
  • To print the date or nearby time onto the screen
  • To suspend the execution of the python string.
  • To gauge the productivity of the code.

Post a Comment

0 Comments