Skip to main content

Subclass of integer representing seconds since UNIX epoch

Project description

time-int

Integer subclass to represent naive time since epoch.

The Idea

UNIX has a venerable tradition of representing time as seconds since the start of 1970. This has its limitations, but it is sometimes desirably simple. This package sub-classes int to give a little handy functionality to this simple approach.

Important Limitations

  • Supported range starts at 0 or TimeInt.MIN on Jan 1, 1970
  • Supported range ends at a 32-bit limit or TimeInt.MAX on Apr 2, 2106
  • Values are rounded off to the nearest second.
  • Values do not track what time-zone they represent.

Quick Example

from time_int import TimeInt

start_time = TimeInt.utcnow()
some_slow_operation()
end_time = TimeInt.utcnow()

print(f"Operation started at {start_time.get_pretty()}")
print(f"Operation ended  at  {end_time.get_pretty()}")
print(f"Operation took {end_time - start_time} seconds")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

time-int-0.0.4.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

time_int-0.0.4-py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page