Skip to content

Commit a74b642

Browse files
committed
API: use UTC timestamps in set attr value endpoint
The platform uses mostly UTC timestamps nowadays, and that also applies to the data ingested. However, datapoints created through "set attribute value" endpoint in the DP3 API still use timezone unaware timestamps. This patch allows unified data processing in the applications.
1 parent 834bd0a commit a74b642

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

dp3/api/routers/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from datetime import datetime
1+
from datetime import datetime, timezone
22
from typing import Annotated, Any, Optional
33

44
from fastapi import APIRouter, Depends, HTTPException, Request
@@ -354,7 +354,7 @@ async def set_eid_attr_value(
354354
id=eid,
355355
attr=attr,
356356
v=body.value,
357-
t1=datetime.now(),
357+
t1=datetime.now(timezone.utc),
358358
src=f"{request.client.host} via API",
359359
)
360360
dp3_dp = api_to_dp3_datapoint(dp.dict())

0 commit comments

Comments
 (0)