util: add TicksSeconds

Add a helper to convert durations to integer seconds.
This commit is contained in:
Lőrinc
2026-01-19 12:35:16 +01:00
parent 22bde74d1d
commit a9440b1595
2 changed files with 15 additions and 0 deletions

View File

@@ -585,6 +585,15 @@ BOOST_AUTO_TEST_CASE(util_mocktime)
SetMockTime(0s);
}
BOOST_AUTO_TEST_CASE(util_ticksseconds)
{
BOOST_CHECK_EQUAL(TicksSeconds(0s), 0);
BOOST_CHECK_EQUAL(TicksSeconds(1s), 1);
BOOST_CHECK_EQUAL(TicksSeconds(999ms), 0);
BOOST_CHECK_EQUAL(TicksSeconds(1000ms), 1);
BOOST_CHECK_EQUAL(TicksSeconds(1500ms), 1);
}
BOOST_AUTO_TEST_CASE(test_IsDigit)
{
BOOST_CHECK_EQUAL(IsDigit('0'), true);