Skip to main content

CityTime

https://img.shields.io/codecov/c/github/tweyter/CityTime.svg CityTime Build status

Thanks: /u/phira

The CityTime object is my solution for the headache of time zones and daylight savings time. It takes the local time and the local time zone, and translates the time into UTC. The time can then be reproduced in various formats and also incremented forward and back while still adjusting for daylight savings time.

CityTime is a tool for comparing the time in two different cities. For example, let’s say it is 5pm in New York and 4pm in Chicago. CityTime will take both of those times and time zones, convert them to UTC, and by comparing the two CityTime objects, will tell you if they are the same time or not (in this case, they are).

Let’s say it’s 8pm in Tokyo on November 1 (UTC + 9), and 7am in New York on the same date (UTC - 4). If you create a CityTime object for each city, and compare the two, it will show that they are the same. However, if you tried the same thing on November 3 (after Daylight Savings Time ends), they will be different, because Japan does not follow Daylight Savings Time.

CityTime handles cases like those mentioned above by converting the input local time to UTC, while storing the Olson Database time zone, rather than just using a UTC offset. This way, local differences in the start and end of Daylight Savings Time are accounted for.

A CityTime object can be instantiated using a datetime.datetime object, an ISO8601 string, or another CityTime object. If instantiated using an ISO8601 string, the time used must be UTC, it will not work with a localized time.

Metadata

Release files for CityTime 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CityTime 1.0.0
File Size Uploaded
CityTime-1.0.0.tar.gz 28.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for CityTime 1.0.0
File Interpreter ABI Platform
CityTime-1.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 39.6 kB

Release files / CityTime-1.0.0.tar.gz

Download URL CityTime-1.0.0.tar.gz
Size 28.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d52526769a092fcb202b45ac07717162ef757537304bc0fa75d70a661e9ce5b9
BLAKE2b-256 checksum
How to use checksums
a8f94679129ec6ea57379ad9774951e05aad4bdbee71882cf5c4c5eb117c5566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.1

Release files / CityTime-1.0.0-py2.py3-none-any.whl

Download URL CityTime-1.0.0-py2.py3-none-any.whl
Size 11.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
72551f53f924e24c264cf578bbcbc723561129991f71a116441480c4314e2dd3
BLAKE2b-256 checksum
How to use checksums
5d9b3d3a362bacee24c112ad92ede93f0c24ce48eda35bba5b7d8300dff25a56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page