enables api_db cache queries if configured with new option (#113)

This commit is contained in:
Miguel Sozinho Ramalho
2023-12-12 19:20:26 +00:00
committed by GitHub
parent 3e56ef137d
commit 6f36e92e02
8 changed files with 40 additions and 12 deletions

View File

@@ -105,7 +105,8 @@ class Metadata:
def get_timestamp(self, utc=True, iso=True) -> datetime.datetime:
ts = self.get("timestamp")
if not ts: return ts
if not ts: return
if type(ts) == float: ts = datetime.datetime.fromtimestamp(ts)
if utc: ts = ts.replace(tzinfo=datetime.timezone.utc)
if iso: return ts.isoformat()
return ts