u32 u32Time = 0; /* Variable to hold the time in milliseconds */
u8 u8TimeOverflowCounter = 0; /* Variable to count u32Time overflows */
void TaskMain(void)
{
/* Check if the millisecond counter has overflown */
if (u32Time > ReadSysTime())
{
u8TimeOverflowCounter++;
}
u32Time = ReadSysTime(); // Read time in milliseconds
/* do rest of the Task... */
/* When you send the timestamp, you need to send the overflow counter and the millisecond time value. */
/* And, when you compare time values, you need to take account for the overflow counter also. */
}