mirror of
https://github.com/FAUSheppy/ths-datenlogger
synced 2025-12-06 04:11:34 +01:00
fix dst on new dbf loggers
This commit is contained in:
@@ -12,8 +12,12 @@ def time_from_dbf(l, timeformat):
|
|||||||
timeformat=None #dont need that here
|
timeformat=None #dont need that here
|
||||||
offset_d = datetime(1970,1,1)-datetime(1900,1,1)
|
offset_d = datetime(1970,1,1)-datetime(1900,1,1)
|
||||||
shit_epoch = l*24*60*60 #days to seconds
|
shit_epoch = l*24*60*60 #days to seconds
|
||||||
unix_epoch = datetime.fromtimestamp(shit_epoch)-offset_d
|
unix_epoch = datetime.fromtimestamp(shit_epoch) - offset_d
|
||||||
return (unix_epoch-timedelta(days=2)+timedelta(hours=CFG("add_hours_to_input"))).replace(microsecond=0)
|
isDaylightSavingsTime = time.localtime(unix_epoch.timestamp())
|
||||||
|
if isDaylightSavingsTime:
|
||||||
|
unix_epoch -= timedelta(hours=1)
|
||||||
|
return (unix_epoch - timedelta(days=2) ).replace(microsecond=0)
|
||||||
|
|
||||||
|
|
||||||
def time_from_csv(l, timeformat):
|
def time_from_csv(l, timeformat):
|
||||||
return datetime.strptime(l, timeformat)
|
return datetime.strptime(l, timeformat)
|
||||||
|
|||||||
Reference in New Issue
Block a user