[Libwebsockets] lwsl_timestamp month one-off error (patch)

Fabian Kurz fabian at fkurz.net
Tue May 31 10:14:38 CEST 2016

Hi Andy,

just noticed that the months in libwebsockets debugging timestamps
are wrong (amazing how long it took me to notice it - but seeing
the 31st of April finally did it).

| $ libwebsockets-test-client
| [2016/04/31 10:05:16:5331] NOTICE: libwebsockets test client - license LGPL2.1+SLE

I suppose this trivial patch fixes it; tm_mon is zero based (at least
on Linux, but I'd be surprised if it's different on Win32 etc.).

diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c
index 43ede68..fcf4674 100644
--- a/lib/libwebsockets.c
+++ b/lib/libwebsockets.c
@@ -1173,7 +1173,7 @@ lwsl_timestamp(int level, char *p, int len)
                        n = snprintf(p, len,
                                "[%04d/%02d/%02d %02d:%02d:%02d:%04d]
%s: ",
                                ptm->tm_year + 1900,
-                               ptm->tm_mon,
+                               ptm->tm_mon + 1,

Best regards and thank you so much for providing libwebsockets!


Fabian Kurz, DJ1YFK      Munich, Germany
fabian at fkurz.net         +49 176 24079617
https://fkurz.net/       http://lcwo.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libwebsockets.c.patch
Type: text/x-diff
Size: 609 bytes
Desc: not available
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20160531/3a086fe0/attachment.bin>

More information about the Libwebsockets mailing list