mirror of https://gitlab.com/pamhyr/pamhyr2
Results, tools: Fix negative timestamp on Windows and some others fixes.
parent
9863b05c30
commit
586f17dc2a
|
|
@ -148,7 +148,7 @@ class PlotH(PamhyrPlot):
|
||||||
def set_reach(self, reach_id):
|
def set_reach(self, reach_id):
|
||||||
self._current_reach_id = reach_id
|
self._current_reach_id = reach_id
|
||||||
self._current_profile_id = 0
|
self._current_profile_id = 0
|
||||||
self.update()
|
self.draw()
|
||||||
|
|
||||||
def set_profile(self, profile_id):
|
def set_profile(self, profile_id):
|
||||||
self._current_profile_id = profile_id
|
self._current_profile_id = profile_id
|
||||||
|
|
|
||||||
|
|
@ -348,6 +348,7 @@ class PlotKPC(PamhyrPlot):
|
||||||
if not self._init:
|
if not self._init:
|
||||||
self.draw()
|
self.draw()
|
||||||
|
|
||||||
|
reach = self.results.river.reach(self._current_reach_id)
|
||||||
if reach.has_sediment():
|
if reach.has_sediment():
|
||||||
self.update_bottom_with_bedload()
|
self.update_bottom_with_bedload()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,11 @@ def old_pamhyr_date_to_timestamp(date: str):
|
||||||
def timestamp_to_old_pamhyr_date(time: int):
|
def timestamp_to_old_pamhyr_date(time: int):
|
||||||
logger.debug(f"timestamp_to_old_pamhyr_date({time}: {type(time)})")
|
logger.debug(f"timestamp_to_old_pamhyr_date({time}: {type(time)})")
|
||||||
t0 = datetime.fromtimestamp(0)
|
t0 = datetime.fromtimestamp(0)
|
||||||
|
|
||||||
|
# HACK: Windows do not accept negative timestamps
|
||||||
|
if time < 0:
|
||||||
|
t = t0 + timedelta(seconds=int(time))
|
||||||
|
else:
|
||||||
t = datetime.fromtimestamp(int(time))
|
t = datetime.fromtimestamp(int(time))
|
||||||
|
|
||||||
dt = t - t0
|
dt = t - t0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue