lwIP sys_now() function bug

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lwIP sys_now() function bug

Jump to solution
2,420 Views
biafra
Senior Contributor I

Hi everyone,

It seems I've found in the sys_now() function of the lwIP library:

u32_t sys_now(void)
{
   return xTaskGetTickCount();
}

It returns the number of ticks from startup, not the number of milliseconds!

It should be:

    return xTaskGetTickCount() * portTICK_PERIOD_MS;

Many thanks

Biafra

1 Solution
1,512 Views
biafra
Senior Contributor I

Hi Daniel,

Thanks for yor answer.

That's why I write my post: at the moment by simply calling the xTaskGetTickCount() function the sys_now() function returns the current time in ticks, not in milliseconds. With the correction I suggested it returns milliseconds.

Many thanks

Biafra

View solution in original post

3 Replies
1,512 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Biafra:

Thanks for your attention.

But it seems the LWIP function documentation says, it returns the current time in milliseconds.

Please refer to the below link

lwIP: Time 

Regards

Daniel

1,513 Views
biafra
Senior Contributor I

Hi Daniel,

Thanks for yor answer.

That's why I write my post: at the moment by simply calling the xTaskGetTickCount() function the sys_now() function returns the current time in ticks, not in milliseconds. With the correction I suggested it returns milliseconds.

Many thanks

Biafra

1,512 Views
danielchen
NXP TechSupport
NXP TechSupport

Thanks, Biafra, I will report it to the developers.

Regards

Daniel