mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-02 22:08:40 +09:00
Use UTC where appropriate in python files
This commit is contained in:
parent
2876988213
commit
30d5f081aa
16 changed files with 29 additions and 29 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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__))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue