%systm_hm% has no leading zero ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
kllei
Normal user
Posts: 11
Joined: 11 Feb 2019, 13:07

%systm_hm% has no leading zero ?

#1 Post by kllei » 05 Apr 2019, 13:25

Hi all,

after playing around a while with ESPeasy I found that the internal variable %systm_hm% does not add a leading zero as described in the docu:
https://www.letscontrolit.com/wiki/inde ... _Variables
%systm_hm% 01:23 Current time if NTP is enabled (hh:mm "old behavior").

lcd,1,1,Time: %systm_hr%
shows:
Time: 9:07
(should be Time: 09:07)

Which results in a shift of the last position if time is before 10:00
%systime% works as expected with leading zero, but shows the seconds...

I could help me with:
lcd,1,1,Time: %syshour_0%:%sysmin_0%

There seems to be no variable like systm_hm_0

And the docu for %syshour% etc. is also misleading, there is no hint to %syshour_0%, min etc.
Is this worth a look into the sources?
I found the SMART_REPL(F("%systm_hm%"), getTimeString(':', false)) but was lost after this ;-)
Thanks for your help!

edit:
digging a bit deeper I found TimeESPeasy.ino

// returns the current Time separated by the given delimiter
// time format example with ':' delimiter: 23:59:59 (HH:MM:SS)
String getTimeString(const struct tm& ts, char delimiter, bool am_pm, bool show_seconds)
{
...

if (show_seconds) {
sprintf_P(TimeString, PSTR("%02d%c%02d%c%02d"),
ts.tm_hour, delimiter, ts.tm_min, delimiter, ts.tm_sec);
} else {
sprintf_P(TimeString, PSTR("%d%c%02d"),
ts.tm_hour, delimiter, ts.tm_min);
}
}
return TimeString;
}

Is this the right line with the missting 02 ?

Thanks again

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: %systm_hm% has no leading zero ?

#2 Post by grovkillen » 05 Apr 2019, 16:27

That's a bug. Please report it on GitHub
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kllei
Normal user
Posts: 11
Joined: 11 Feb 2019, 13:07

Re: %systm_hm% has no leading zero ?

#3 Post by kllei » 05 Apr 2019, 17:42

OK, I opened an issue. Hopefully I didn't miss to much.
Should I have referred to this entry?

Best Regards!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 91 guests