pace: fix duration formatting
parent
4493b343bd
commit
eabb2a8828
|
|
@ -82,8 +82,7 @@ const draw = () => {
|
||||||
pace = "No GPS";
|
pace = "No GPS";
|
||||||
}
|
}
|
||||||
|
|
||||||
const tm = time_utils.decodeTime(exs.state.duration);
|
layout["time"]!.label = formatDuration(exs.state.duration);
|
||||||
layout["time"]!.label = tm.d ? time_utils.formatDuration(tm) : time_utils.formatTime(tm); // formatTime throws if tm.d > 0
|
|
||||||
layout["pace"]!.label = pace;
|
layout["pace"]!.label = pace;
|
||||||
layout.render();
|
layout.render();
|
||||||
|
|
||||||
|
|
@ -91,6 +90,15 @@ const draw = () => {
|
||||||
layout.forgetLazyState(), lastUnlazy = now;
|
layout.forgetLazyState(), lastUnlazy = now;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const pad2 = (n: number) => `0${n}`.substr(-2);
|
||||||
|
|
||||||
|
const formatDuration = (ms: number) => {
|
||||||
|
const tm = time_utils.decodeTime(ms);
|
||||||
|
if(tm.h)
|
||||||
|
return `${tm.h}:${pad2(tm.m)}:${pad2(tm.s)}`;
|
||||||
|
return `${pad2(tm.m)}:${pad2(tm.s)}`;
|
||||||
|
};
|
||||||
|
|
||||||
const drawSplits = () => {
|
const drawSplits = () => {
|
||||||
g.clearRect(Bangle.appRect);
|
g.clearRect(Bangle.appRect);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue