Thanks to Bob Harris, I use functions (FC's) to convert HMI integer setpoints to S5time. The code inside the function looks like what WJhsson posted above. One function for hundredths, one for tenths, one for seconds, and one for minutes. The input is declared as an IN-OUT and if the input is greater than the time the S5timer will support, the function clamps it.
One thing that is not good about S5 timers or IEC timers is once the timer starts timing it no longer looks at the preset. So if you set a timer to 5 minutes and it starts timing, changing the preset to 10 seconds has no effect. Obviously this is not a good thing, not the way AB or GE works.
To combat this, as well as making the time conversion to S5 time format unnecessary, simply make your own timer function. For an integer timer, declare Timer.ACC, Timer.PRE, Timer.1shot, and Timer.DN in a data block (structures work well).
Inside your timer function declare local variables as needed. When enable input is on, use an ADD_I instruction to add a one to the Timer.ACC if the ACC not GEQ the PRE. Next rung compares the ACC to the PRE and sets the Done output.
When you call your FC it will be a timer and work the way normal timers from AB or GE work. Plus you don't have to worry about running out of S5 timers (we had 128 when I started with S7-300 ten years ago) or using lots of instance data blocks like the IEC timers.
I call the timer all the time. I use boolean permissives in series with the enable input along with a 1-second pulse generated from an S5 timer. Alternatively you could call the timer FC in OB35. In the hardware configuration if you set OB35 to be called every 100ms then your timer FC would have a 100ms time base.
I will be glad to post a library of examples if requested. This was one of the big "gotchas" back when I started and people helped me get through them.