mirror of https://github.com/m-labs/artiq.git
time_to_cycles: round instead of flooring
This commit is contained in:
parent
0158de5ac9
commit
7c4450a963
|
@ -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):
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue