Close #10278: Add time.wallclock() function, monotonic clock.

This commit is contained in:
Victor Stinner 2012-01-18 01:50:21 +01:00
parent 25d1bdc407
commit b94b266cfc
5 changed files with 75 additions and 5 deletions

View file

@ -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)