The time Module
There is a popular time module available in Python, which provides functions for working with times and for converting between representations.
Here is the list of all available methods.
S.no
|
Function
|
Description
|
1
|
The offset of the local DST timezone, in
seconds west of UTC, if one is defined.This is negative if the local DST
timezone is east of UTC (as in Western Europe,including the UK). Use this if
the daylight is nonzero.
|
|
2
|
Accepts a time-tuple and returns a readable
24-character string such as ‘Sun Mar 11 10:09:20 2018’.
|
|
3
|
Returns the current CPU time as a
floating-point number of seconds. To measure computational costs of different
approaches, the value of time. Clock is more useful than that of time.time().
|
|
4
|
Like asctime(localtime(secs)) and without
arguments is like asctime()
|
|
5
|
Accepts an instant expressed in seconds
since the epoch and returns a time-tuple t with the UTC time. Note :
t.tm_isdst is always 0
|
|
6
|
Accepts an instant expressed in seconds
since the epoch and returns a time-tuple t with the local time (t.tm_isdst is
0 or 1, depending on whether DST applies to instant secs by local rules).
|
|
7
|
Accepts an instant expressed as a time-tuple
in local time and returns a floating-point value with the instant expressed
in seconds since the epoch.
|
|
8
|
Suspends the calling thread for secs
seconds.
|
|
9
|
Accepts an instant expressed as a time-tuple
in local time and returns a string representing the instant as specified by
string fmt.
|
|
10
|
time.strptime(str,fmt=’%a %b %d %H:%M:%S
%Y’)
|
Parses str according to format string fmt and
returns the instant in time-tuple format.
|
11
|
time.time()
|
Returns the current time instant, a
floating-point number of seconds since the epoch.
|
12
|
time.tzset()
|
Resets the time conversion rules used by the
library routines. The environment variable TZ specifies how this is done.
|