summaryrefslogtreecommitdiffstatshomepage
path: root/docs/library/time.rst
blob: a12eab3b23c9129996980282540caa6814e0d4e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
:mod:`time` --- time related functions
======================================

.. module:: time
   :synopsis: time related functions

The ``time`` module provides functions for getting the current time and date,
and for sleeping.


Functions
---------

.. function:: localtime([secs])

   Convert a time expressed in seconds since Jan 1, 2000 into an 8-tuple which
   contains: (year, month, mday, hour, minute, second, weekday, yearday)
   If secs is not provided or None, then the current time from the RTC is used.
   year includes the century (for example 2014)
   month   is 1-12
   mday    is 1-31
   hour    is 0-23
   minute  is 0-59
   second  is 0-59
   weekday is 0-6 for Mon-Sun.
   yearday is 1-366

.. function:: mktime()

   This is inverse function of localtime. It's argument is a full 8-tuple
   which expresses a time as per localtime. It returns an integer which is
   the number of seconds since Jan 1, 2000.

.. function:: sleep(seconds)

   Sleep for the given number of seconds.  Seconds can be a floating-point number to
   sleep for a fractional number of seconds.

.. function:: time()

   Returns the number of seconds, as an integer, since 1/1/2000.