mirror of
https://github.com/internetarchive/warcprox.git
synced 2025-01-18 13:22:09 +01:00
make UTC a constant available externally
This commit is contained in:
parent
073c1fb578
commit
1c07ae2ea9
@ -8,16 +8,17 @@ import socket
|
||||
import os
|
||||
import datetime
|
||||
|
||||
try:
|
||||
UTC = datetime.timezone.utc
|
||||
except:
|
||||
UTC = r.make_timezone("00:00")
|
||||
|
||||
def utcnow():
|
||||
"""Convenience function to get timezone-aware UTC datetime. RethinkDB
|
||||
requires timezone-aware datetime for its native time type, and
|
||||
unfortunately datetime.datetime.utcnow() is not timezone-aware. Also python
|
||||
2 doesn't come with a timezone implementation."""
|
||||
try:
|
||||
utc = datetime.timezone.utc
|
||||
except:
|
||||
utc = r.make_timezone("00:00")
|
||||
return datetime.datetime.now(utc)
|
||||
return datetime.datetime.now(UTC)
|
||||
|
||||
class RethinkerWrapper(object):
|
||||
logger = logging.getLogger('rethinkstuff.RethinkerWrapper')
|
||||
|
Loading…
x
Reference in New Issue
Block a user