summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-02 12:00:37 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-02 12:00:37 -0500
commitc0c702a5e3284e843e680064b4c6a7280242c567 (patch)
tree59332b13537a0c006c090ae925e8d3be50bb4699 /js
parent45d4933f568d8814d8045852a9a1b006b912dcf7 (diff)
downloadUXP-c0c702a5e3284e843e680064b4c6a7280242c567.tar
UXP-c0c702a5e3284e843e680064b4c6a7280242c567.tar.gz
UXP-c0c702a5e3284e843e680064b4c6a7280242c567.tar.lz
UXP-c0c702a5e3284e843e680064b4c6a7280242c567.tar.xz
UXP-c0c702a5e3284e843e680064b4c6a7280242c567.zip
Use UTC where appropriate in python files
Diffstat (limited to 'js')
-rw-r--r--js/src/gdb/progressbar.py4
-rw-r--r--js/src/tests/lib/progressbar.py4
-rw-r--r--js/src/tests/lib/tasks_unix.py8
-rw-r--r--js/src/tests/lib/tasks_win.py4
4 files changed, 10 insertions, 10 deletions
diff --git a/js/src/gdb/progressbar.py b/js/src/gdb/progressbar.py
index d96a67c96..faf571ffb 100644
--- a/js/src/gdb/progressbar.py
+++ b/js/src/gdb/progressbar.py
@@ -12,7 +12,7 @@ class ProgressBar(object):
self.limit = limit
self.label_width = label_width
self.cur = 0
- self.t0 = datetime.datetime.now()
+ self.t0 = datetime.datetime.utcnow()
self.fullwidth = None
self.barlen = 64 - self.label_width
@@ -23,7 +23,7 @@ class ProgressBar(object):
pct = int(100.0 * self.cur / self.limit)
barlen = int(1.0 * self.barlen * self.cur / self.limit) - 1
bar = '='*barlen + '>'
- dt = datetime.datetime.now() - self.t0
+ dt = datetime.datetime.utcnow() - self.t0
dt = dt.seconds + dt.microseconds * 1e-6
line = self.fmt%(self.label[:self.label_width], pct, bar, dt)
self.fullwidth = len(line)
diff --git a/js/src/tests/lib/progressbar.py b/js/src/tests/lib/progressbar.py
index 29361660d..da578783d 100644
--- a/js/src/tests/lib/progressbar.py
+++ b/js/src/tests/lib/progressbar.py
@@ -28,7 +28,7 @@ class ProgressBar(object):
# field in the counters map.
self.limit = limit # int: The value of 'current' equal to 100%.
self.limit_digits = int(math.ceil(math.log10(self.limit))) # int: max digits in limit
- self.t0 = datetime.now() # datetime: The start time.
+ self.t0 = datetime.utcnow() # datetime: The start time.
# Compute the width of the counters and build the format string.
self.counters_width = 1 # [
@@ -68,7 +68,7 @@ class ProgressBar(object):
sys.stdout.write(bar + '|')
# Update the bar.
- dt = datetime.now() - self.t0
+ dt = datetime.utcnow() - self.t0
dt = dt.seconds + dt.microseconds * 1e-6
sys.stdout.write('{:6.1f}s'.format(dt))
Terminal.clear_right()
diff --git a/js/src/tests/lib/tasks_unix.py b/js/src/tests/lib/tasks_unix.py
index 655033522..487c749ee 100644
--- a/js/src/tests/lib/tasks_unix.py
+++ b/js/src/tests/lib/tasks_unix.py
@@ -14,7 +14,7 @@ class Task(object):
self.pid = pid
self.stdout = stdout
self.stderr = stderr
- self.start = datetime.now()
+ self.start = datetime.utcnow()
self.out = []
self.err = []
@@ -59,7 +59,7 @@ def get_max_wait(tasks, timeout):
# If a timeout is supplied, we need to wake up for the first task to
# timeout if that is sooner.
if timeout:
- now = datetime.now()
+ now = datetime.utcnow()
timeout_delta = timedelta(seconds=timeout)
for task in tasks:
remaining = task.start + timeout_delta - now
@@ -136,7 +136,7 @@ def timed_out(task, timeout):
timed_out always returns False).
"""
if timeout:
- now = datetime.now()
+ now = datetime.utcnow()
return (now - task.start) > timedelta(seconds=timeout)
return False
@@ -175,7 +175,7 @@ def reap_zombies(tasks, timeout):
''.join(ended.out),
''.join(ended.err),
returncode,
- (datetime.now() - ended.start).total_seconds(),
+ (datetime.utcnow() - ended.start).total_seconds(),
timed_out(ended, timeout)))
return tasks, finished
diff --git a/js/src/tests/lib/tasks_win.py b/js/src/tests/lib/tasks_win.py
index 7a4540c60..a99640abb 100644
--- a/js/src/tests/lib/tasks_win.py
+++ b/js/src/tests/lib/tasks_win.py
@@ -36,7 +36,7 @@ def _do_work(qTasks, qResults, qWatch, prefix, run_skipped, timeout, show_cmd):
cmd = test.get_command(prefix)
if show_cmd:
print(escape_cmdline(cmd))
- tStart = datetime.now()
+ tStart = datetime.utcnow()
proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
@@ -49,7 +49,7 @@ def _do_work(qTasks, qResults, qWatch, prefix, run_skipped, timeout, show_cmd):
qWatch.put(TaskFinishedMarker)
# Create a result record and forward to result processing.
- dt = datetime.now() - tStart
+ dt = datetime.utcnow() - tStart
result = TestOutput(test, cmd, out, err, proc.returncode, dt.total_seconds(),
dt > timedelta(seconds=timeout))
qResults.put(result)