From 899a03420461b6701f03932e5b81a336631800f8 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 13 Aug 2014 17:59:53 +0800 Subject: [PATCH] compiler/lower_time: adapt to new unit system --- artiq/compiler/lower_time.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/artiq/compiler/lower_time.py b/artiq/compiler/lower_time.py index 61e9f83ba..2705a84c7 100644 --- a/artiq/compiler/lower_time.py +++ b/artiq/compiler/lower_time.py @@ -1,4 +1,5 @@ import ast +from artiq.compiler.tools import value_to_ast class _TimeLowerer(ast.NodeTransformer): def __init__(self, ref_period): @@ -6,9 +7,9 @@ class _TimeLowerer(ast.NodeTransformer): def visit_Call(self, node): if isinstance(node.func, ast.Name) \ - and node.func.id == "Quantity" and node.args[1].id == "base_s_unit": + and node.func.id == "Quantity" and node.args[1].id == "s_unit": return ast.copy_location( - ast.BinOp(left=node.args[0], op=ast.FloorDiv(), right=ast.Num(self.ref_period.amount)), + ast.BinOp(left=node.args[0], op=ast.Div(), right=value_to_ast(self.ref_period.amount)), node) elif isinstance(node.func, ast.Name) and node.func.id == "now": return ast.copy_location(ast.Name("now", ast.Load()), node)