Skip to content

Commit

Permalink
use datetime.timestamp to get time since epoch
Browse files Browse the repository at this point in the history
The previous solution is prone to misconfigurations of time zones.
  • Loading branch information
mampfes committed Jan 22, 2024
1 parent 6d19a91 commit 1cfec6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions custom_components/epex_spot/EPEXSpot/Awattar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
from datetime import datetime, timedelta, timezone
from time import mktime

import aiohttp
from homeassistant.util import dt
Expand Down Expand Up @@ -42,7 +41,7 @@ def price_ct_per_kwh(self):


def toEpochMilliSec(dt: datetime) -> int:
return mktime(dt.timetuple()) * 1000
return int(dt.timestamp() * 1000)


class Awattar:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/epex_spot/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/mampfes/ha_epex_spot/issues",
"requirements": ["bs4"],
"version": "2.3.2"
"version": "2.3.3.2"
}

0 comments on commit 1cfec6f

Please sign in to comment.