Fix timedelta precision by importing attotimedelta

total_seconds() method from Python's datetime class outputs a Float
precision number which for some numbers multiplied by 10^n gives wrong
values.
total_seconds() method from attotime class wraps a native timedelta
object and outputs a Decimal precision number which fixes this issue.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
This commit is contained in:
Rafal Stefanowski
2020-01-21 16:43:54 +01:00
parent 80d71fabea
commit 88efaa1940
2 changed files with 3 additions and 4 deletions

View File

@@ -177,8 +177,7 @@ class Cache:
if alru_params.staleness_time else None,
alru_params.flush_max_buffers
if alru_params.flush_max_buffers else None,
int(alru_params.activity_threshold.total_seconds()
* 1000)
alru_params.activity_threshold.total_milliseconds()
if alru_params.activity_threshold else None)
def get_cache_config(self):