summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-01-18 00:50:21 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2012-01-18 00:50:21 (GMT)
commitb94b266cfc94491eef206c082ff210d147016cbc (patch)
tree93e1d696fd477d16d4360a14718d4676345710d0 /Lib/test/test_time.py
parent25d1bdc4074a93f268e40be1a8e49f003c3cbe57 (diff)
downloadcpython-b94b266cfc94491eef206c082ff210d147016cbc.zip
cpython-b94b266cfc94491eef206c082ff210d147016cbc.tar.gz
cpython-b94b266cfc94491eef206c082ff210d147016cbc.tar.bz2
Close #10278: Add time.wallclock() function, monotonic clock.
Diffstat (limited to 'Lib/test/test_time.py')
-rw-r--r--Lib/test/test_time.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_time.py b/Lib/test/test_time.py
index a73588c..ede85b7 100644
--- a/Lib/test/test_time.py
+++ b/Lib/test/test_time.py
@@ -332,6 +332,13 @@ class TimeTestCase(unittest.TestCase):
self.assertEqual(time.strftime('%Z', tt), tzname)
+ def test_wallclock(self):
+ t0 = time.wallclock()
+ time.sleep(0.1)
+ t1 = time.wallclock()
+ t = t1 - t0
+ self.assertAlmostEqual(t, 0.1, places=2)
+
class TestLocale(unittest.TestCase):
def setUp(self):
self.oldloc = locale.setlocale(locale.LC_ALL)