]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
lwip: provide a sntp_format_time() function
authorJerome Forissier <jerome.forissier@linaro.org>
Thu, 24 Jul 2025 15:26:35 +0000 (17:26 +0200)
committerJerome Forissier <jerome.forissier@linaro.org>
Fri, 1 Aug 2025 07:30:47 +0000 (09:30 +0200)
Provide a trivial implementation of sntp_format_time() to fix a build
error when CONFIG_LWIP_DEBUG=y:

lib/lwip/lwip/src/apps/sntp/sntp.c: In function ‘sntp_format_time’:
lib/lwip/lwip/src/apps/sntp/sntp.c:283:10: error: implicit declaration of function ‘ctime’ [-Werror=implicit-function-declaration]
  283 |   return ctime(&ut);
      |          ^~~~~

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
lib/lwip/u-boot/arch/cc.h

index f91127ac56581204bed49b4c04e3951e8ffa79c3..04ab94d6b700a9c9819a18f3be91ec39eb5f0974 100644 (file)
 void sntp_set_system_time(uint32_t sec);
 #define SNTP_SET_SYSTEM_TIME(sec) sntp_set_system_time(sec)
 
+static inline const char *sntp_format_time(time_t t)
+{
+       static char buf[29]; /* "(time_t)" + 20 digits max + \0 */
+
+       snprintf(buf, sizeof(buf), "(time_t)%llu", t);
+       return buf;
+}
+
+#define sntp_format_time sntp_format_time
 #endif /* LWIP_ARCH_CC_H */