Hi,
You are right. 'Can_Ipw_GetTimeElapsed' already considers the rollover of the time base so that return value of the 'Can_Ipw_GetTimeElapsed' is correct.
It means that 'TimestampPtr->nanoseonds is correct even though the rollover happens between 'Value' and 'CurrCompareValTemp' in the red rectangular of the below capture.

Let's suppose as below:
CAN_43_FLEXCAN_TS_STM_TARGETTIME = 0x2625A00 = 4000000
Value = 0xFFFFFFFA
CurrCompareValTemp = 0x2625A00
'TimestampPtr->nanoseconds' would be calculated as 0x2625A01 so that 'TimestampPtr->nanoseconds' is greater than 'CAN_43_FLEXCAN_TS_STM_TARGETTIME
In yellow rectangular, Value(0xFFFFFFFA) is greater than CurrCompareValTemp(0x2625A00). However, that's not the situation which the programmer wants. In the perspective of physical timeline which doesn't have the roll-over concept, the 'Value' does not exceed 'CurrCompareValTemp'.
Therefore, codes in white rectangular shall not be executed.