Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unixtime format is not working on windows #1908

Closed
intx82 opened this issue Nov 21, 2020 · 2 comments
Closed

Unixtime format is not working on windows #1908

intx82 opened this issue Nov 21, 2020 · 2 comments

Comments

@intx82
Copy link

intx82 commented Nov 21, 2020

Unixtime format specified via command line arguments is not working on Windows, but works well on Unix.
'mosquitto_sub' exiting right after start

C:\Program Files\mosquitto>mosquitto_sub -h host -t /# -F "%U %t %p"  //<- exited after start

C:\Program Files\mosquitto>mosquitto_sub -h host -t /# -v //<- Works well
/b8:27:eb:f2:97:2c/894064187/9 1094486852
/b8:27:eb:f2:97:2c/894064187/10 1037368820
/b8:27:eb:f2:97:2c/894064187/11 1067245149
/b8:27:eb:f2:97:2c/894064187/12 1103636726

C:\Program Files\mosquitto>mosquitto_sub -h host -t /# -F "%t %p"   //<- Works well
/b8:27:eb:f2:97:2c/894064187/10 1038800475
/b8:27:eb:f2:97:2c/894064187/11 1068299564
/b8:27:eb:f2:97:2c/894064187/12 1103636726

C:\Program Files\mosquitto>mosquitto_sub --help
mosquitto_sub is a simple mqtt client that will subscribe to a set of topics and print all messages it receives.
mosquitto_sub version 1.6.12 running on libmosquitto 1.6.12.
...
ralight added a commit that referenced this issue Nov 26, 2020
Seconds since the Unix epoch is not a parameter that can be obtained
with strftime on Windows.

Closes #1908. Thanks to Danil intl.
ralight added a commit that referenced this issue Nov 26, 2020
Seconds since the Unix epoch is not a parameter that can be obtained
with strftime on Windows.

Closes #1908. Thanks to Danil intl.
@ralight
Copy link
Contributor

ralight commented Nov 26, 2020

Thank you for this report. Unfortunately Unix timestamps aren't supported by the Windows version of strftime. That function was producing an error when you tried it, hence the immediate exit. I've changed it so a message is printed to make it obvious what is going on at least.

@intx82
Copy link
Author

intx82 commented Nov 29, 2020

Okay, thanks, you can close the issue.
I have found another solution:

mosquitto_sub -h host -t /# -v -F "%t %p" | perl d:/wrk/tools/moreutils/ts "[%s]"

@intx82 intx82 closed this as completed Dec 1, 2020
fAuernigg pushed a commit to fAuernigg/mosquitto that referenced this issue Jan 4, 2021
Seconds since the Unix epoch is not a parameter that can be obtained
with strftime on Windows.

Closes eclipse#1908. Thanks to Danil intl.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants