fix python 3.12 utcnow() deprecation warning

Warning is:

/usr/lib64/python3.12/site-packages/ifcopenshell/api/project/create_file.py:61:
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version.
Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
This commit is contained in:
Bruno Postle
2023-11-23 21:16:24 +00:00
parent 70a1d7d345
commit 1d972a6a6f
2 changed files with 2 additions and 2 deletions
@@ -58,7 +58,7 @@ class Usecase:
self.file = ifcopenshell.file(schema=self.settings["version"])
self.file.wrapped_data.header.file_name.name = "/dev/null" # Hehehe
self.file.wrapped_data.header.file_name.time_stamp = (
datetime.datetime.utcnow()
datetime.datetime.now(datetime.UTC)
.replace(tzinfo=datetime.timezone.utc)
.astimezone()
.replace(microsecond=0)