diff --git a/artiq/language/core.py b/artiq/language/core.py index 02f89899b..0c695be21 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -347,7 +347,7 @@ def time_to_cycles(time, core=None): """ if core is None: raise ValueError("Core device must be specified for time conversion") - return int64(time.amount//core.runtime_env.ref_period) + return round64(time.amount//core.runtime_env.ref_period) def cycles_to_time(cycles, core=None): diff --git a/artiq/transforms/lower_time.py b/artiq/transforms/lower_time.py index 2b0c136fa..be84a57f8 100644 --- a/artiq/transforms/lower_time.py +++ b/artiq/transforms/lower_time.py @@ -11,7 +11,7 @@ def _time_to_cycles(ref_period, node): right=value_to_ast(ref_period)), node) return ast.copy_location( - ast.Call(func=ast.Name("int64", ast.Load()), + ast.Call(func=ast.Name("round64", ast.Load()), args=[divided], keywords=[], starargs=[], kwargs=[]), divided)