From 27ab5a6471b91405bfce21877d1d1e766ed79df1 Mon Sep 17 00:00:00 2001 From: Tobias Langer Date: Mon, 14 Nov 2016 18:02:38 +0100 Subject: [PATCH] There is no math.gcd in python3. --- tasksetgen.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tasksetgen.py b/tasksetgen.py index 747e829..bdc7c5d 100755 --- a/tasksetgen.py +++ b/tasksetgen.py @@ -45,11 +45,14 @@ def query_yes_no(question, default=None): elif 'no'.find(choice) == 0: return False +def gcd(a, b): + return gcd(b, a % b) + def lcm(a, b): - return (a * b) / math.gcd(a, b) + return (a * b) / gcd(a, b) def hyperperiod(tasks): - periods = [x.period for task in tasks] + periods = [task.period for task in tasks] hyperperiod = periods[0] for period in periods[1:]: hyperperiod = lcm(hyperperiod, period) -- libgit2 0.26.0