Skip to content

Commit

Permalink
Replace pytz by built-in datetime module
Browse files Browse the repository at this point in the history
... to reduce external dependency.

Change-Id: I6005942ec4af5fc01f60c5a4ed52c39548d79367
  • Loading branch information
kajinamit committed Jun 10, 2024
1 parent 2c2bb5e commit 8b2dbb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import datetime
import os
import pytz

from oslo_log import log as oslo_logging

Expand Down Expand Up @@ -70,11 +69,11 @@ def _get_expire_interval(self, data):
if isinstance(expiredate, str):
year, month, day = map(int, expiredate.split('-'))
expiredate = datetime.datetime(year=year, month=month, day=day,
tzinfo=pytz.utc)
tzinfo=datetime.timezone.utc)
# Py2.7 does not support timestamps, this is the
# only way to compute the seconds passed since the unix epoch
unix_time = datetime.datetime(year=1970, month=1, day=1,
tzinfo=pytz.utc)
tzinfo=datetime.timezone.utc)
expire_interval = (expiredate - unix_time).total_seconds()

return expire_interval
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ oslo.log
Babel>=1.3
oauthlib
netifaces
pytz
PyYAML
requests
untangle==1.2.1
Expand Down

0 comments on commit 8b2dbb5

Please sign in to comment.