From 4da64d19a49f5b4e247c1c5ccbcc3702b436aed5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 13 May 2004 17:00:52 +0000 Subject: [PATCH] fixed time.time() bug - occasionally keeping cron jobs from starting instead of time.time() all over the code, there is a right_now = int(time.time()) at the beginning which is used instead of time.time() (so there aren't different times being set at different points of the code's execution) svn path=/trunk/boinc/; revision=3376 --- sched/start | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sched/start b/sched/start index 5156d37802..3982109e64 100755 --- a/sched/start +++ b/sched/start @@ -119,6 +119,7 @@ import boinc_path_config from Boinc import configxml import sys, os, getopt, time, glob, fcntl, signal, socket +right_now = int(time.time()) verbose = os.isatty(sys.stdout.fileno()) verbose_daemon_run = 0 # how long (in seconds) parent should wait before continuing after a fork. @@ -211,7 +212,7 @@ def ensure_dir(filename): return def timestamp(t = None): - return time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(t or time.time())) + return time.strftime('%Y/%m/%d %H:%M:%S', time.localtime(t or right_now)) def safe_read_int(filename): try: @@ -397,10 +398,10 @@ def when_will_task_next_run(task, task_run_state): def time_to_run_task(task, task_run_state): return (ignore_timestamps - or (time.time() >= when_will_task_next_run(task,task_run_state))) + or (right_now >= when_will_task_next_run(task,task_run_state))) def update_task_timestamp(task_run_state): - task_run_state.last_run = time.time() + task_run_state.last_run = right_now def run_task(task): '''Fork and exec command without stdout/err redirection''' @@ -571,7 +572,7 @@ def command_status(): when_last_run = float(task_run_state.last_run) last_run = when_last_run and timestamp(when_last_run) or '?' when_next_run = when_will_task_next_run(task, lookup_task_run_state(task)) - next_run = (when_next_run <=time.time()) and 'NOW' or timestamp(when_next_run) + next_run = (when_next_run <= right_now) and 'NOW' or timestamp(when_next_run) if is_lock_file_locked(get_task_lock_name(task)): lu = " LOCKED " else: