diff --git a/src/bonsai/bonsai/bim/export_ifc.py b/src/bonsai/bonsai/bim/export_ifc.py index 633d6292f9..f28c106e95 100644 --- a/src/bonsai/bonsai/bim/export_ifc.py +++ b/src/bonsai/bonsai/bim/export_ifc.py @@ -72,9 +72,7 @@ class IfcExporter: def set_header(self): self.file.header.file_name.name = os.path.basename(self.ifc_export_settings.output_file) - self.file.header.file_name.time_stamp = ( - datetime.datetime.utcnow().replace(tzinfo=datetime.UTC).astimezone().replace(microsecond=0).isoformat() - ) + self.file.header.file_name.time_stamp = datetime.datetime.now().astimezone().replace(microsecond=0).isoformat() self.file.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version) self.file.header.file_name.originating_system = "{} {}".format( self.get_application_name(), tool.Blender.get_bonsai_version() diff --git a/src/ifcopenshell-python/ifcopenshell/api/project/create_file.py b/src/ifcopenshell-python/ifcopenshell/api/project/create_file.py index e122ba766b..a28f6dfa46 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/project/create_file.py +++ b/src/ifcopenshell-python/ifcopenshell/api/project/create_file.py @@ -53,9 +53,7 @@ def create_file(version: ifcopenshell.util.schema.IFC_SCHEMA = "IFC4") -> ifcope """ file = ifcopenshell.file(schema=version) file.header.file_name.name = "/dev/null" # Hehehe - file.header.file_name.time_stamp = ( - datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).astimezone().replace(microsecond=0).isoformat() - ) + file.header.file_name.time_stamp = datetime.datetime.now().astimezone().replace(microsecond=0).isoformat() file.header.file_name.preprocessor_version = "IfcOpenShell {}".format(ifcopenshell.version) file.header.file_name.originating_system = "IfcOpenShell {}".format(ifcopenshell.version) file.header.file_name.authorization = "Nobody" diff --git a/src/ifcpatch/ifcpatch/recipes/PurgeData.py b/src/ifcpatch/ifcpatch/recipes/PurgeData.py index 3c34927a63..0ea968f48a 100644 --- a/src/ifcpatch/ifcpatch/recipes/PurgeData.py +++ b/src/ifcpatch/ifcpatch/recipes/PurgeData.py @@ -57,13 +57,7 @@ class Patcher: def patch(self): self.file.header.file_name.name = "Rabbit" - self.file.header.file_name.time_stamp = ( - datetime.datetime.utcnow() - .replace(tzinfo=datetime.timezone.utc) - .astimezone() - .replace(microsecond=0) - .isoformat() - ) + self.file.header.file_name.time_stamp = datetime.datetime.now().astimezone().replace(microsecond=0).isoformat() self.file.header.file_name.preprocessor_version = "Rabbit" self.file.header.file_name.originating_system = "Rabbit" diff --git a/src/opencdeserver/api/app/security/secure.py b/src/opencdeserver/api/app/security/secure.py index fec837b868..e332c94647 100644 --- a/src/opencdeserver/api/app/security/secure.py +++ b/src/opencdeserver/api/app/security/secure.py @@ -1,7 +1,7 @@ from __future__ import annotations import os -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from database.neo4j import db from fastapi import Depends, HTTPException, Security, status @@ -33,10 +33,8 @@ credentials_exception = HTTPException( def create_access_token(data: dict, expires_delta: timedelta | None = None): payload = data.copy() - if expires_delta: - expire = datetime.utcnow() + expires_delta - else: - expire = datetime.utcnow() + timedelta(minutes=15) + expires_delta = expires_delta or timedelta(minutes=15) + expire = datetime.now(timezone.utc) + expires_delta payload.update({"expires": str(expire)}) encoded_jwt = jwt.encode(payload, secrets["security_secret_key"], algorithm=os.environ["SECURITY_ALGORITHM"]) return encoded_jwt