The fix is calculating in the elapsed ticks at the init time to remove the problematic offset.
Details:
The HAL tick counter is reflecting the elapsed time since the startup of the MCU. When the xi_bsp_time_init() is called the tick counter is already containing the elapsed time (it is non-zero). This distorts the result of the xi_bsp_time_getcurrenttime_seconds() function as a problematic offset will appear. This is even more significant in case the xi_bsp_time_init() is called repeatedly or with a delay.
The fix is calculating in the elapsed ticks at the init time to remove the problematic offset. Details: The HAL tick counter is reflecting the elapsed time since the startup of the MCU. When the xi_bsp_time_init() is called the tick counter is already containing the elapsed time (it is non-zero). This distorts the result of the xi_bsp_time_getcurrenttime_seconds() function as a problematic offset will appear. This is even more significant in case the xi_bsp_time_init() is called repeatedly or with a delay.