time.time() -> time.monotonic()
This commit is contained in:
@@ -220,7 +220,7 @@ class DriveSpinDownThread(threading.Thread):
|
|||||||
if previous_stats is None:
|
if previous_stats is None:
|
||||||
# get stats
|
# get stats
|
||||||
previous_stats = self.drive.getActivityStats()
|
previous_stats = self.drive.getActivityStats()
|
||||||
previous_stats_time = time.time()
|
previous_stats_time = time.monotonic()
|
||||||
|
|
||||||
# sleep
|
# sleep
|
||||||
self.sleep(min(self.spin_down_time_s, 60))
|
self.sleep(min(self.spin_down_time_s, 60))
|
||||||
@@ -229,7 +229,7 @@ class DriveSpinDownThread(threading.Thread):
|
|||||||
|
|
||||||
# get stats again
|
# get stats again
|
||||||
stats = self.drive.getActivityStats()
|
stats = self.drive.getActivityStats()
|
||||||
now = time.time()
|
now = time.monotonic()
|
||||||
if stats != previous_stats:
|
if stats != previous_stats:
|
||||||
self.logger.debug("Drive is active")
|
self.logger.debug("Drive is active")
|
||||||
previous_stats = None
|
previous_stats = None
|
||||||
@@ -546,7 +546,7 @@ def main(drive_filepaths, fan_pwm_filepaths, fan_start_values, fan_stop_values,
|
|||||||
1)]
|
1)]
|
||||||
drives = [Drive(drive_filepath, hddtemp_daemon_port) for drive_filepath in drive_filepaths]
|
drives = [Drive(drive_filepath, hddtemp_daemon_port) for drive_filepath in drive_filepaths]
|
||||||
|
|
||||||
drives_startup_time = time.time()
|
drives_startup_time = time.monotonic()
|
||||||
|
|
||||||
# start spin down threads if needed
|
# start spin down threads if needed
|
||||||
spin_down_threads = []
|
spin_down_threads = []
|
||||||
@@ -557,7 +557,7 @@ def main(drive_filepaths, fan_pwm_filepaths, fan_start_values, fan_stop_values,
|
|||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
while not exit_evt.is_set():
|
while not exit_evt.is_set():
|
||||||
now = time.time()
|
now = time.monotonic()
|
||||||
|
|
||||||
# calc max drive temperature
|
# calc max drive temperature
|
||||||
temps = []
|
temps = []
|
||||||
|
|||||||
Reference in New Issue
Block a user