---
source: https://iinventedlight.com/library/notes/python-time.md
title: "time: epoch-based clocks, struct_time, and sleep"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, time — Time access and conversions; CPython, time module documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-23
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-23
as_of: 2026-11-23
confidence: medium
untested: "Not reproduced (2026-11-23). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-time"
tags: [python, time, epoch, sleep, clocks]
client: Librarian
sources:
  - id: S1
    title: "time — Time access and conversions"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/time.html
    accessed: 2026-11-23
    license: "PSF License Version 2"
  - id: S2
    title: "time module documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/time.rst
    accessed: 2026-11-23
    license: "PSF License Version 2"
---
# time: epoch-based clocks, struct_time, and sleep
**Answer:** This module provides various time-related functions. Although this module is always available, not all functions are available on all platforms. The epoch is the point where the time starts. On all platforms, that instant is January 1, 1970, 00:00:00 (UTC).

## Epoch and portability

time collects various time-related functions. For related functionality, see also the datetime and calendar modules.

The module itself is always available, but not all functions are available on all platforms.

The epoch is the point where the time starts, and it is also the return value of time.gmtime(0).

On all platforms, that instant is January 1, 1970, 00:00:00 (UTC).

The term seconds since the epoch refers to elapsed seconds since the epoch.

Leap seconds are excluded from this total on all POSIX-compliant platforms.

## sleep

time.sleep(seconds) will suspend execution of the calling thread for the given number of seconds.

A non-integer argument is allowed when you need a more precise sleep time.

## The source documentation

The library source documentation also says not all functions are available on all platforms.

It also defines the epoch as the point where the time starts, matching time.gmtime(0), which is January 1, 1970, 00:00:00 UTC everywhere.

## See also

- [python-datetime](https://iinventedlight.com/library/notes/python-datetime/)
- [python-calendar](https://iinventedlight.com/library/notes/python-calendar/)
- [python-zoneinfo](https://iinventedlight.com/library/notes/python-zoneinfo/)

## Claims

- id: C1
  claim: The time module provides various time-related functions.
  source: S1
  evidence: "This module provides various time-related functions"

- id: C2
  claim: Not all functions are available on all platforms.
  source: S1
  evidence: "not all functions are available on all platforms"

- id: C3
  claim: The epoch is 1 January 1970, 00:00:00 UTC on all platforms.
  source: S1
  evidence: "It is January 1, 1970, 00:00:00 (UTC) on all platforms"

- id: C4
  claim: sleep suspends the calling thread for the given number of seconds.
  source: S1
  evidence: "Suspend execution of the calling thread for the given number of seconds"

- id: C5
  claim: The source docs also define the epoch using gmtime(0).
  source: S2
  evidence: "time.gmtime(0)"

## Sources

- [S1] time — Time access and conversions. Python Software Foundation. https://docs.python.org/3/library/time.html . License: PSF License Version 2. Accessed 2026-11-23.

- [S2] time module documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/time.rst . License: PSF License Version 2. Accessed 2026-11-23.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, time — Time access and conversions; CPython, time module documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
