From b169dc0b1ecadebbcd2ad54970f0890278a9955d Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Thu, 26 Nov 2020 09:10:04 +0000 Subject: [PATCH] mosquitto_sub will quit with an error on Windows if %U is used. Seconds since the Unix epoch is not a parameter that can be obtained with strftime on Windows. Closes #1908. Thanks to Danil intl. --- ChangeLog.txt | 2 ++ client/client_shared.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4cf8a639..409b0805 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -137,6 +137,8 @@ Clients: precision for some parameters. - Add `--version` for all clients. - Fix description of `-e` and `-t` arguments in mosquitto_rr. Closes #1881. +- mosquitto_sub will now quit with an error if the %U option is used on + Windows, rather than just quitting. Closes #1908. 1.6.12 - 2020-08-19 diff --git a/client/client_shared.c b/client/client_shared.c index c43775a9..6d6f448a 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -132,6 +132,10 @@ static int check_format(const char *str) // JSON output, assuming JSON payload }else if(str[i+1] == 'U'){ // Unix time+nanoseconds +#ifdef WIN32 + fprintf(stderr, "Error: The %%U format option is not supported on Windows.\n"); + return 1; +#endif }else if(str[i+1] == 'x' || str[i+1] == 'X'){ // payload in hex }else{