Use a monotonic clock source for power monitoring (#1861)

old-commit-hash: 897ee6bd2b11f313455fd00baff7eee5d45afac5
This commit is contained in:
Adeeb Shihadeh
2020-07-12 01:46:02 -07:00
committed by GitHub
parent 0d6df8fc79
commit 28181e86bf
+2 -1
View File
@@ -5,6 +5,7 @@ import time
from statistics import mean
from cereal import log
from common.realtime import sec_since_boot
from selfdrive.swaglog import cloudlog
PANDA_OUTPUT_VOLTAGE = 5.28
@@ -67,7 +68,7 @@ class PowerMonitoring:
# Calculation tick
def calculate(self, health):
try:
now = time.time()
now = sec_since_boot()
# Check that time is valid
if datetime.datetime.fromtimestamp(now).year < 2019: