diff --git a/src/python/m5/ticks.py b/src/python/m5/ticks.py index 047116ac78..cdba1e86ae 100644 --- a/src/python/m5/ticks.py +++ b/src/python/m5/ticks.py @@ -25,7 +25,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from __future__ import print_function -from math import ceil +import decimal import six if six.PY3: long = int @@ -74,7 +74,8 @@ def fromSeconds(value): # convert the value from time to ticks value *= _m5.core.getClockFrequency() - int_value = int(ceil(value)) + int_value = int( + decimal.Decimal(value).to_integral_value( decimal.ROUND_HALF_UP)) err = (value - int_value) / value if err > frequency_tolerance: warn("rounding error > tolerance\n %f rounded to %d", value,