MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_timerfd_TFD_TIMER_ABSTIME

Method test_timerfd_TFD_TIMER_ABSTIME

Lib/test/test_os.py:4408–4432  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4406 self.assertEqual(self.read_count_signaled(fd), count)
4407
4408 def test_timerfd_TFD_TIMER_ABSTIME(self):
4409 fd = self.timerfd_create(time.CLOCK_REALTIME)
4410
4411 now = time.clock_gettime(time.CLOCK_REALTIME)
4412
4413 # 1 second later from now.
4414 offset = 1
4415 initial_expiration = now + offset
4416 # not interval timer
4417 interval = 0
4418
4419 os.timerfd_settime(fd, flags=os.TFD_TIMER_ABSTIME, initial=initial_expiration, interval=interval)
4420
4421 # timerfd_gettime
4422 # Note: timerfd_gettime returns relative values even if TFD_TIMER_ABSTIME is specified.
4423 next_expiration, interval2 = os.timerfd_gettime(fd)
4424 self.assertAlmostEqual(interval2, interval, places=self.CLOCK_RES_PLACES)
4425 self.assertAlmostEqual(next_expiration, offset, places=self.CLOCK_RES_PLACES)
4426
4427 t = time.perf_counter()
4428 count_signaled = self.read_count_signaled(fd)
4429 t = time.perf_counter() - t
4430 self.assertEqual(count_signaled, 1)
4431
4432 self.assertGreater(t, offset - self.CLOCK_RES)
4433
4434 def test_timerfd_select(self):
4435 fd = self.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)

Callers

nothing calls this directly

Calls 5

timerfd_createMethod · 0.95
read_count_signaledMethod · 0.95
assertGreaterMethod · 0.80
assertAlmostEqualMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected