Skip to content

Commit

Permalink
Avoid Python's stupidly named "utcnow" function
Browse files Browse the repository at this point in the history
The function returns a timezone-adjusted value and thus appears to have
absolutely nothing to do with UTC.  Thanks Python.

I think perhaps the function must have been a typo for "utcnot" because
the function specifically returns something that is *not* UTC.
  • Loading branch information
jagerman committed Jul 2, 2022
1 parent 0718282 commit 0c42eb9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@ def parse_mempool(mempool_future):

@app.context_processor
def template_globals():
now = datetime.now(timezone.utc)
return {
'config': conf,
'server': {
'datetime': datetime.now(timezone.utc),
'timestamp': datetime.utcnow().timestamp(),
'datetime': now,
'timestamp': now.timestamp(),
'revision': git_rev,
},
}
Expand Down

0 comments on commit 0c42eb9

Please sign in to comment.