Skip to content

Commit 7c4450a

Browse files
committedOct 13, 2014
time_to_cycles: round instead of flooring
1 parent 0158de5 commit 7c4450a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎artiq/language/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def time_to_cycles(time, core=None):
347347
"""
348348
if core is None:
349349
raise ValueError("Core device must be specified for time conversion")
350-
return int64(time.amount//core.runtime_env.ref_period)
350+
return round64(time.amount//core.runtime_env.ref_period)
351351

352352

353353
def cycles_to_time(cycles, core=None):

‎artiq/transforms/lower_time.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def _time_to_cycles(ref_period, node):
1111
right=value_to_ast(ref_period)),
1212
node)
1313
return ast.copy_location(
14-
ast.Call(func=ast.Name("int64", ast.Load()),
14+
ast.Call(func=ast.Name("round64", ast.Load()),
1515
args=[divided],
1616
keywords=[], starargs=[], kwargs=[]),
1717
divided)

0 commit comments

Comments
 (0)
Please sign in to comment.