/
Scoreboard objective: deltatime
example:
scoreboard players operation untilactionprev objective = untilaction objective
scoreboard players operation untilaction objective -= tickstoadd deltatime
execute if score untilaction objective matches ..20 unless score untilactionprev objective matches ..20 run function my:action1
execute if score untilaction objective matches ..0 unless score untilactionprev objective matches ..0 run function my:action2
If you just want to time one action, you can just check for ..0 without the helper variable
(note that if you set the counter to a lower/higher (according to the direction of counting) value while the counter is counting and you won't also change the previous count, it will execute everything in between the previous and current value)
Also check out the mod version for even better accuracy! (although even less maintained)

Keep track of the real time even on laggy servers (uses the worldborder method)