mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Close #10278: Add time.wallclock() function, monotonic clock.
This commit is contained in:
parent
25d1bdc407
commit
b94b266cfc
5 changed files with 75 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue