summaryrefslogtreecommitdiff
path: root/python
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 /python
parent45d4933f568d8814d8045852a9a1b006b912dcf7 (diff)
downloaduxp-c0c702a5e3284e843e680064b4c6a7280242c567.tar.gz
Use UTC where appropriate in python files
Diffstat (limited to 'python')
-rw-r--r--python/mock-1.0.0/tests/testhelpers.py6
-rw-r--r--python/mozbuild/mozbuild/android_version_code.py2
-rw-r--r--python/psutil/docs/conf.py2
-rwxr-xr-xpython/psutil/examples/top.py2
4 files changed, 6 insertions, 6 deletions
diff --git a/python/mock-1.0.0/tests/testhelpers.py b/python/mock-1.0.0/tests/testhelpers.py
index e788da8447..f41023c371 100644
--- a/python/mock-1.0.0/tests/testhelpers.py
+++ b/python/mock-1.0.0/tests/testhelpers.py
@@ -41,21 +41,21 @@ class AnyTest(unittest2.TestCase):
def test_any_and_datetime(self):
mock = Mock()
- mock(datetime.now(), foo=datetime.now())
+ mock(datetime.utcnow(), foo=datetime.utcnow())
mock.assert_called_with(ANY, foo=ANY)
def test_any_mock_calls_comparison_order(self):
mock = Mock()
- d = datetime.now()
+ d = datetime.utcnow()
class Foo(object):
def __eq__(self, other):
return False
def __ne__(self, other):
return True
- for d in datetime.now(), Foo():
+ for d in datetime.utcnow(), Foo():
mock.reset_mock()
mock(d, foo=d, bar=d)
diff --git a/python/mozbuild/mozbuild/android_version_code.py b/python/mozbuild/mozbuild/android_version_code.py
index 69ce22b8ea..6d9445c630 100644
--- a/python/mozbuild/mozbuild/android_version_code.py
+++ b/python/mozbuild/mozbuild/android_version_code.py
@@ -79,7 +79,7 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0):
'''
def hours_since_cutoff(buildid):
# The ID is formatted like YYYYMMDDHHMMSS (using
- # datetime.now().strftime('%Y%m%d%H%M%S'); see build/variables.py).
+ # datetime.utcnow().strftime('%Y%m%d%H%M%S'); see build/variables.py).
# The inverse function is time.strptime.
# N.B.: the time module expresses time as decimal seconds since the
# epoch.
diff --git a/python/psutil/docs/conf.py b/python/psutil/docs/conf.py
index 9fa163b65e..ad880110f8 100644
--- a/python/psutil/docs/conf.py
+++ b/python/psutil/docs/conf.py
@@ -18,7 +18,7 @@ import os
PROJECT_NAME = "psutil"
AUTHOR = "Giampaolo Rodola'"
-THIS_YEAR = str(datetime.datetime.now().year)
+THIS_YEAR = str(datetime.datetime.utcnow().year)
HERE = os.path.abspath(os.path.dirname(__file__))
diff --git a/python/psutil/examples/top.py b/python/psutil/examples/top.py
index 7aebef1d42..30df417f55 100755
--- a/python/psutil/examples/top.py
+++ b/python/psutil/examples/top.py
@@ -165,7 +165,7 @@ def print_header(procs_status, num_procs):
st.sort(key=lambda x: x[:3] in ('run', 'sle'), reverse=1)
print_line(" Processes: %s (%s)" % (num_procs, ' '.join(st)))
# load average, uptime
- uptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time())
+ uptime = datetime.utcnow() - datetime.fromtimestamp(psutil.boot_time())
av1, av2, av3 = os.getloadavg()
line = " Load average: %.2f %.2f %.2f Uptime: %s" \
% (av1, av2, av3, str(uptime).split('.')[0])