Bug in SNTP?

SpenZerX
Posts: 41
Joined: Thu Apr 16, 2015 9:30 pm
Location: Germany
Contact:

Bug in SNTP?

Postby SpenZerX » Sun Jun 21, 2015 6:35 am

Hi,

possible bug in SNTP

Source:

#if DEBUG>5
os_printf("String: %s Strlen: %d\n", sntp_get_real_time(current_stamp),strlen(sntp_get_real_time(current_stamp)) );
#endif

Result on Debug Terminal:

String: Sat Jun 20 20:25:54 2015
Strlen: 25

Bug: String should be 24 chars long, char 25 is unwanted carrier return?

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Bug in SNTP?

Postby ESP_Faye » Wed Jun 24, 2015 11:38 am

Hi,

Thanks for your reporting !

This is not a bug.

strlen is 25 because we have a line break symbol (\n) there, if you need to use the length, please try strlen() - 1

Who is online

Users browsing this forum: No registered users and 2 guests