Skip to content

Commit

Permalink
generators: get rid of deprecation warning nicer way
Browse files Browse the repository at this point in the history
datetime.datetime.now(datetime.timezone.utc) should work on Python 3.10
and newer.
  • Loading branch information
hrw committed Nov 29, 2023
1 parent 74c0f5d commit 7d511d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions generate-cpu-cores-table.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from datetime import datetime
from datetime import datetime, timezone
from jinja2 import Environment, FileSystemLoader

import tables
Expand Down Expand Up @@ -42,7 +42,8 @@ def generate_html_file(cpu_cores):
template = env.get_template("arm-cpu-cores.html.j2")

output = template.render(
generate_time=datetime.strftime(datetime.utcnow(), "%d %B %Y %H:%M"),
generate_time=datetime.strftime(datetime.now(timezone.utc),
"%d %B %Y %H:%M"),
cpu_cores=cpu_cores,
)
print(output)
Expand Down
5 changes: 3 additions & 2 deletions generate.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

from datetime import datetime
from datetime import datetime, timezone
from jinja2 import Environment, FileSystemLoader

import tables
Expand Down Expand Up @@ -118,7 +118,8 @@ def generate_html_file(socs, cpu_features, cpu_cores):
template = env.get_template("arm-socs.html.j2")

output = template.render(
generate_time=datetime.strftime(datetime.utcnow(), "%d %B %Y %H:%M"),
generate_time=datetime.strftime(datetime.now(timezone.utc),
"%d %B %Y %H:%M"),
socs=socs,
cpu_features=cpu_features,
cpu_cores=cpu_cores,
Expand Down

0 comments on commit 7d511d8

Please sign in to comment.