Skip to content

Commit 5c2dba1

Browse files
committed
lap times without leading zeroes
1 parent 135e5f8 commit 5c2dba1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/displayapp/screens/StopWatch.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,24 @@ void StopWatch::RenderLaps() {
179179
if (lap) {
180180
TimeSeparated laptime = ConvertTicksToTimeSegments(lap->timeSinceStart);
181181
char buffer[19];
182-
if (laptime.hours == 0) {
183-
snprintf(buffer, sizeof(buffer), "\n#%-3d %2d:%02d.%02d", lap->number, laptime.mins, laptime.secs, laptime.hundredths);
184-
} else {
185-
snprintf(buffer,
186-
sizeof(buffer),
187-
"\n#%-3d %3d:%02d:%02d.%02d",
182+
if (laptime.hours > 0) {
183+
snprintf(buffer, sizeof(buffer), "\n#%-3d %3d:%02d:%02d.%02d",
188184
lap->number,
189185
laptime.hours,
190186
laptime.mins,
191187
laptime.secs,
192188
laptime.hundredths);
189+
} else if (laptime.mins > 0) {
190+
snprintf(buffer, sizeof(buffer), "\n#%-3d %2d:%02d.%02d",
191+
lap->number,
192+
laptime.mins,
193+
laptime.secs,
194+
laptime.hundredths);
195+
} else {
196+
snprintf(buffer, sizeof(buffer), "\n#%-3d %2d.%02d",
197+
lap->number,
198+
laptime.secs,
199+
laptime.hundredths);
193200
}
194201
lv_label_ins_text(lapText, LV_LABEL_POS_LAST, buffer);
195202
}

0 commit comments

Comments
 (0)