Explorar o código

WebSockCallbacks.c: replace obsolete asctime()

The asctime() function is marked as obsolete by POSIX.1-2008-
Replace with recommended strftime();

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Danny Al-Gaaf %!s(int64=10) %!d(string=hai) anos
pai
achega
1d5124ed5e
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      examples/websocket/WebSockCallbacks.c

+ 1 - 2
examples/websocket/WebSockCallbacks.c

@@ -148,8 +148,7 @@ static void * eventMain(void * arg) {
     while (ws_ctx->runLoop) {
     while (ws_ctx->runLoop) {
         time_t t = time(0);
         time_t t = time(0);
         struct tm * timestr = localtime(&t);
         struct tm * timestr = localtime(&t);
-        sprintf(msg,"title %s",asctime(timestr));
-
+        strftime(msg, sizeof(msg), "title %c", timestr);
         send_to_all_websockets(ctx, msg, strlen(msg));
         send_to_all_websockets(ctx, msg, strlen(msg));
 
 
         mg_sleep(1000);
         mg_sleep(1000);