timer: fix off-by-one ms error

Fix #5103