You can refer to the below links and attachment:
S12ZVC Getting Started Exercises where TIM example can be found:
S12Z Frequency Measurement at PT0 (IOC0_0) by TIM module in input capture mode:
In the attachment, see the example which uses the Input-capture function of the Timer module for duty-cycle measurement.
Other MagniV examples and application notes are available here:
I hope ti helps.