STM8 alarm firing shortly after resetting time
Wouldn't be easier to use some fixed time interrupt, like 1ms. If possible use systick timer interrupt if your MCU supports. Then you can write multiple instances of timers: on-delay, of-delay, pulse,...you can find some IEC timer examples from PLC manuals. These do increment, compare, set output flag according to elapsed time. They are all updated at fixed interval (systick). In my opinion you don't need a nanosecond/microsecond precise timing, so you cold use a single hw timer interrupt to update all timer instances.