Skip to content

Commit 5224357

Browse files
authored
Revert "Fix UTC Timezone"
1 parent 6e2b43f commit 5224357

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
version = constants['version']
3131

3232
release = version
33-
copyright = '{}, {}. Version {}'.format(datetime.datetime.now(datetime.UTC).year, author, version)
33+
copyright = '{}, {}. Version {}'.format(datetime.datetime.utcnow().year, author, version)
3434

3535
# -- General configuration ---------------------------------------------------
3636

flask_monitoringdashboard/controllers/endpoints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def get_endpoint_overview(session):
3232
:param session: session for the database
3333
:return: A list of properties for each endpoint that is found in the database
3434
"""
35-
week_ago = datetime.datetime.now(datetime.UTC) - datetime.timedelta(days=7)
36-
now_local = to_local_datetime(datetime.datetime.now(datetime.UTC))
35+
week_ago = datetime.datetime.utcnow() - datetime.timedelta(days=7)
36+
now_local = to_local_datetime(datetime.datetime.utcnow())
3737
today_local = now_local.replace(hour=0, minute=0, second=0, microsecond=0)
3838
today_utc = to_utc_datetime(today_local)
3939

flask_monitoringdashboard/core/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ def update_last_requested_cache(endpoint_name):
6969
Use this instead of updating the last requested to the database.
7070
"""
7171
global memory_cache
72-
memory_cache.get(endpoint_name).set_last_requested(datetime.datetime.now(datetime.UTC))
72+
memory_cache.get(endpoint_name).set_last_requested(datetime.datetime.utcnow())
7373

7474

7575
def update_duration_cache(endpoint_name, duration):
7676
"""
7777
Use this together with adding a request to the database.
7878
"""
7979
global memory_cache
80-
memory_cache.get(endpoint_name).set_last_requested(datetime.datetime.now(datetime.UTC))
80+
memory_cache.get(endpoint_name).set_last_requested(datetime.datetime.utcnow())
8181
memory_cache.get(endpoint_name).set_duration(duration)
8282

8383

flask_monitoringdashboard/core/telemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def initialize_telemetry_session(session):
8787
else:
8888
telemetry_user = session.query(TelemetryUser).one()
8989
telemetry_user.times_initialized += 1
90-
telemetry_user.last_initialized = datetime.datetime.now(datetime.UTC)
90+
telemetry_user.last_initialized = datetime.datetime.utcnow()
9191
session.commit()
9292

9393
# reset telemetry if declined in previous session

flask_monitoringdashboard/core/timezone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def to_local_datetime(dt):
1010
from flask_monitoringdashboard import config
1111

1212
if dt:
13-
return dt + config.timezone.utcoffset(datetime.datetime.now(datetime.UTC))
13+
return dt + config.timezone.utcoffset(datetime.datetime.utcnow())
1414
return None
1515

1616

@@ -23,5 +23,5 @@ def to_utc_datetime(dt):
2323
from flask_monitoringdashboard import config
2424

2525
if dt:
26-
return dt - config.timezone.utcoffset(datetime.datetime.now(datetime.UTC))
26+
return dt - config.timezone.utcoffset(datetime.datetime.utcnow())
2727
return None

flask_monitoringdashboard/database/endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def update_last_requested(session, endpoint_name, timestamp=None):
150150
:param endpoint_name: name of the endpoint
151151
:param timestamp: optional timestamp. If not given, timestamp is current time
152152
"""
153-
ts = timestamp if timestamp else datetime.datetime.now(datetime.UTC)
153+
ts = timestamp if timestamp else datetime.datetime.utcnow()
154154
session.query(Endpoint).filter(Endpoint.name == endpoint_name).update(
155155
{Endpoint.last_requested: ts}
156156
)

0 commit comments

Comments
 (0)