Mercurial > cpython-lru_cache-weakref
diff Lib/test/test_time.py @ 74475:bb10cd354e49
Close #10278: Add time.wallclock() function, monotonic clock.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Wed, 18 Jan 2012 01:50:21 +0100 |
| parents | e37a7dc8944e |
| children | 83e8c3a6a81c |
line wrap: on
line diff
--- a/Lib/test/test_time.py Wed Jan 18 02:32:07 2012 +0200 +++ b/Lib/test/test_time.py Wed Jan 18 01:50:21 2012 +0100 @@ -332,6 +332,13 @@ 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)
