Good day to all.
One of users of my wf asked to add seconds. I’ve used options, where you can select to show seconds or dots between Hrs. and Min. I’ve used vertical position of seconds in digits.
Main question, that seconds coming with delay. When you just look on device (so it’s going out from sleep) for few seconds in shows good, but periodically lost seconds: 1-2-5-6-8 etc. Here below my code. Will be appreciated for advices, how to optimize it, to remove delays.
//Seconds or dots
//Seconds
if(App.getApp().getProperty("ShowSeconds")){
var secondsFirstDig = (System.getClockTime().sec)/10;
var secondsSecondDig = (System.getClockTime().sec) - secondsFirstDig * 10;
//Darw seconds
var showFirstDig= new Ui.Text({
:text=>secondsFirstDig.toString(),
:color=>Gfx.COLOR_LT_GRAY,
:font=>Ui.loadResource(Rez.Fonts.Day),
:locX =>120,
:locY=>95,
:justification=>Gfx.TEXT_JUSTIFY_CENTER
});
showFirstDig.draw(dc);
var showSecondDig= new Ui.Text({
:text=>secondsSecondDig.toString(),
:color=>Gfx.COLOR_LT_GRAY,
:font=>Ui.loadResource(Rez.Fonts.Day),
:locX =>120,
:locY=>115,
:justification=>Gfx.TEXT_JUSTIFY_CENTER
});
showSecondDig.draw(dc);
}
else{
//Draw Dots or Do not Disturb if on
dc.setPenWidth(1);
if(Sys.getDeviceSettings().doNotDisturb){
dc.setColor(Gfx.COLOR_RED, Gfx.COLOR_TRANSPARENT);
dc.drawCircle(120, 112, 5);
dc.drawLine(123, 115, 116, 108);
dc.drawCircle(120, 132, 5);
dc.drawLine(123, 135, 116, 128);
}
else{
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
dc.drawCircle(120, 112, 5);
dc.drawCircle(120, 132, 5);
}
}