From 7bd6fe0afaa8093f61e4e9dab0a32dc45323bf4c Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Thu, 9 Aug 2012 10:52:40 -0700 Subject: [PATCH] Bug 781445 - Remove a python 2.7 only function from tasks_unix.py; r=benjamin --- js/src/tests/lib/tasks_unix.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/src/tests/lib/tasks_unix.py b/js/src/tests/lib/tasks_unix.py index 34442e7e3ab..82018f8dcbd 100644 --- a/js/src/tests/lib/tasks_unix.py +++ b/js/src/tests/lib/tasks_unix.py @@ -42,6 +42,9 @@ def spawn_test(test): cmd = test.get_command(test.js_cmd_prefix) os.execvp(cmd[0], cmd) +def total_seconds(td): + return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6 + def get_max_wait(tasks, results, timeout): """ Return the maximum time we can wait before any task should time out. @@ -52,7 +55,7 @@ def get_max_wait(tasks, results, timeout): remaining = timedelta(seconds=timeout) - (now - task.start) if remaining > wait: wait = remaining - wait = wait.total_seconds() + wait = total_seconds(wait) # The test harness uses a timeout of 0 to indicate we should wait forever, # but for select(), a timeout of 0 indicates a zero-length wait. Instead, @@ -163,7 +166,7 @@ def reap_zombies(tasks, results, timeout): ''.join(ended.out), ''.join(ended.err), returncode, - (datetime.now() - ended.start).total_seconds(), + total_seconds(datetime.now() - ended.start), timed_out(ended, timeout)) results.push(out) return tasks