timer_test failed to compile if cmocka was enabled but threads were not

(cherry picked from commit c73e3175)
42 jobs for !1552 with each-fix-timer-test-v9_11 in 11 minutes and 10 seconds (queued for 5 seconds)
merge request