mirror of
https://github.com/btclock/btclock_v3.git
synced 2024-11-19 06:30:02 +01:00
feat: add 0 prefix to single digit hours
This commit is contained in:
parent
85579e98cf
commit
ab5f2e953c
@ -82,12 +82,19 @@ void workerTask(void *pvParameters) {
|
|||||||
std::string timeString;
|
std::string timeString;
|
||||||
|
|
||||||
String minute = String(timeinfo.tm_min);
|
String minute = String(timeinfo.tm_min);
|
||||||
|
String hour = String(timeinfo.tm_hour);
|
||||||
|
|
||||||
|
if (hour.length() < 2) {
|
||||||
|
hour = "0" + hour;
|
||||||
|
}
|
||||||
if (minute.length() < 2) {
|
if (minute.length() < 2) {
|
||||||
minute = "0" + minute;
|
minute = "0" + minute;
|
||||||
}
|
}
|
||||||
|
|
||||||
timeString =
|
timeString = timeString.append(hour.c_str());
|
||||||
std::to_string(timeinfo.tm_hour) + ":" + minute.c_str();
|
timeString = timeString.append(String(":").c_str());
|
||||||
|
timeString = timeString.append(minute.c_str());
|
||||||
|
|
||||||
timeString.insert(timeString.begin(),
|
timeString.insert(timeString.begin(),
|
||||||
NUM_SCREENS - timeString.length(), ' ');
|
NUM_SCREENS - timeString.length(), ' ');
|
||||||
taskEpdContent[0] = std::to_string(timeinfo.tm_mday) + "/" +
|
taskEpdContent[0] = std::to_string(timeinfo.tm_mday) + "/" +
|
||||||
|
Loading…
Reference in New Issue
Block a user