Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove misleading "in UTC" #1882

Merged
merged 1 commit into from
Nov 15, 2020
Merged

remove misleading "in UTC" #1882

merged 1 commit into from
Nov 15, 2020

Conversation

zed
Copy link
Contributor

@zed zed commented Nov 15, 2020

"seconds since the epoch" (value returned by time.time()) doesn't
depend on the local time zone. It is the same time instance around the
world. It is not in any particular time zone:

import datetime as DT
import zoneinfo

local_time = DT.datetime.fromtimestamp(seconds_since_epoch)    # naive datetime object representing local time
utc_time = DT.datetime.utcfromtimestamp(seconds_since_epoch)  # naive datetime object representing utc time
la_time = DT.datetime.fromtimestamp(seconds_since_epoch, zoneinfo.ZoneInfo("America/Los_Angeles"))   # timezone aware dt

Here local_time, utc_time, la_time may correspond to different
clock times but it is exactly the same time instance.

"seconds since the epoch" (value returned by `time.time()`) doesn't
depend on the local time zone. It is the same time instance around the
world. It is not in any particular time zone:

```python
import datetime as DT
import zoneinfo

local_time = DT.datetime.fromtimestamp(seconds_since_epoch)    # naive datetime object representing local time
utc_time = DT.datetime.utcfromtimestamp(seconds_since_epoch)  # naive datetime object representing utc time
la_time = DT.datetime.fromtimestamp(seconds_since_epoch, zoneinfo.ZoneInfo("America/Los_Angeles"))   # timezone aware dt
```

Here `local_time`, `utc_time`, `la_time` may correspond to different
clock times but it is exactly the same time instance.
@giampaolo giampaolo merged commit 21bb082 into giampaolo:master Nov 15, 2020
@zed zed deleted the patch-1 branch November 15, 2020 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants