dani007200964 / Commander-API

Commander-API is a simple to use C++ parser library and you can easily use it to process character based commands
MIT License
24 stars 4 forks source link

Print leading zeros in uptime func #15

Closed ondras12345 closed 1 year ago

ondras12345 commented 1 year ago

The uptime built-in command would print something like 0 days, 0:3:2, whereas I think 0 days, 0:03:02 is better.

dev seems to be one commit behind, so I'm targeting master. Let me know if you want me to change that.


I was also a little scared of the 20 character buffer - I did some calculations and it seems like sizeof "49 days, 17:02:47" is 18, so it should be ok. I would use snprintf(buff, sizeof buff, ...); if this was my code, just to be sure. It is slower though.

dani007200964 commented 1 year ago

You are right. I close this PR and I will expand the buffer size to 30. It should be enough. I will also modify it to use snprintf.