Skip to content

Commit

Permalink
Merge pull request #294 from rafalste/fix_timedelta_precision
Browse files Browse the repository at this point in the history
Fix timedelta precision by importing attotimedelta instead
  • Loading branch information
Ostrokrzew authored Jan 21, 2020
2 parents 33d5ed1 + 5c3554f commit 445f0cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions test/functional/api/cas/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ def set_params_alru(self, alru_params: FlushParametersAlru):
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):
Expand Down
4 changes: 2 additions & 2 deletions test/functional/api/cas/cache_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import IntEnum
from aenum import Enum
from test_utils.size import Size, Unit
from datetime import timedelta
from attotime import attotimedelta


class CacheLineSize(Enum):
Expand Down Expand Up @@ -79,7 +79,7 @@ class CacheStatus(Enum):
incomplete = 5


class Time(timedelta):
class Time(attotimedelta):
def total_milliseconds(self):
return int(self.total_seconds() * 1000)

Expand Down
1 change: 1 addition & 0 deletions test/functional/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
attotime>=0.2.0

0 comments on commit 445f0cb

Please sign in to comment.