Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7123204
D6927.id25112.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D6927.id25112.diff
View Options
diff --git a/swh/web/common/converters.py b/swh/web/common/converters.py
--- a/swh/web/common/converters.py
+++ b/swh/web/common/converters.py
@@ -11,7 +11,12 @@
from swh.core.utils import decode_with_escape
from swh.model import hashutil
-from swh.model.model import RawExtrinsicMetadata, Release, Revision
+from swh.model.model import (
+ RawExtrinsicMetadata,
+ Release,
+ Revision,
+ TimestampWithTimezone,
+)
from swh.model.swhids import ObjectType
from swh.storage.interface import PartialBranches
from swh.web.common.typing import OriginInfo, OriginVisitInfo
@@ -124,8 +129,7 @@
- a dict with three keys:
- timestamp (dict or integer timestamp)
- - offset
- - negative_utc
+ - offset_bytes
- or, a datetime
@@ -137,20 +141,10 @@
if isinstance(v, datetime.datetime):
return v.isoformat()
- tz = datetime.timezone(datetime.timedelta(minutes=v["offset"]))
- swh_timestamp = v["timestamp"]
- if isinstance(swh_timestamp, dict):
- date = datetime.datetime.fromtimestamp(swh_timestamp["seconds"], tz=tz)
- else:
- date = datetime.datetime.fromtimestamp(swh_timestamp, tz=tz)
-
- datestr = date.isoformat()
-
- if v["offset"] == 0 and v["negative_utc"]:
- # remove the rightmost + and replace it with a -
- return "-".join(datestr.rsplit("+", 1))
-
- return datestr
+ v = v.copy()
+ if isinstance(v["timestamp"], float):
+ v["timestamp"] = int(v["timestamp"])
+ return TimestampWithTimezone.from_dict(v).to_datetime().isoformat()
if not dict_swh:
return dict_swh
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 18, 2:51 AM (1 d, 22 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3219987
Attached To
D6927: Remove special handling of negative_utc
Event Timeline
Log In to Comment