Skip to content

Commit 9485ce5

Browse files
authored
Fix timezone info for Ogmios backend (#176)
* Update ogmios.py * use datetime instead of calendar and time
1 parent afe78c3 commit 9485ce5

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

pycardano/backend/ogmios.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import calendar
21
import json
3-
import time
2+
from datetime import datetime
43
from enum import Enum
54
from typing import Any, Dict, List, Optional, Tuple, Union
65

@@ -192,11 +191,9 @@ def genesis_param(self) -> GenesisParameters:
192191

193192
def _fetch_genesis_param(self) -> GenesisParameters:
194193
result = self._query_genesis_config()
195-
system_start_unix = int(
196-
calendar.timegm(
197-
time.strptime(result["systemStart"].split(".")[0], "%Y-%m-%dT%H:%M:%S"),
198-
)
199-
)
194+
start_str = result["systemStart"].split(".")[0]
195+
dt = datetime.fromisoformat(start_str.replace("Z", "+00:00"))
196+
system_start_unix = int(dt.timestamp())
200197
return GenesisParameters(
201198
active_slots_coefficient=self._fraction_parser(
202199
result["activeSlotsCoefficient"]

0 commit comments

Comments
 (0)