Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ontick skipping seconds

Why is the ontick skipping seconds ?

 

// timeColonEl.text = ":";
timeColonEl.style.display = 'inline';

export function animateColon()
{
if(timeColonEl.style.display == 'none')
{
timeColonEl.style.display = 'inline';
}
else
{
timeColonEl.style.display = 'none';
}
}

export function getElement(type){
return document.getElementById(device.screen.width + "-" + type)
}

//Time Draw - START
export function drawTime(now) {
setHours(now);
setMinutes(now);
setSeconds(now);
}

export function setSeconds(now){
if (showSeconds)
{
timeSecEl.style.display= 'inline';
timeSecEl.text = zeroPad(now.getSeconds());
}
else
{
timeSecEl.style.display= 'none';
}
}

export function setMinutes(now){
timeMinuteEl.text = zeroPad(now.getMinutes());
}

export function setHours(now) {
var hours = now.getHours();
let clockFormat = timeFormat;
if(timeFormat === "auto")
{
clockFormat = preferences.clockDisplay;
}

if (clockFormat === "12h") {
// 12h format
if (isAmPm) {
if (hours < 12) {
timeAmPmEl.text = " AM";
} else {
timeAmPmEl.text = " PM";
}
timeAmPmEl.style.display= 'inline';
}
else
{
timeAmPmEl.style.display= 'none';
}

if (hours === 0)
{
hours = 12;
} else if (hours > 12) {
hours = hours - 12;
}
} else {
// 24h format
timeAmPmEl.style.display= 'none';
}

if(showLeadingZero)
{
timeHourEl.text = zeroPad(hours);
}
else
{
timeHourEl.text = hours;
}
}
//Time Draw - END

export function zeroPad(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}

 

clock.ontick = (evt) => {
time.drawTime(evt.date);
}

Best Answer
0 Votes
2 REPLIES 2

Hi, I saw that the ontick function is randomly skipping seconds.

Can anyone else check ?

 

code:

// timeColonEl.text = ":";
timeColonEl.style.display = 'inline';

export function animateColon()
{
if(timeColonEl.style.display == 'none')
{
timeColonEl.style.display = 'inline';
}
else
{
timeColonEl.style.display = 'none';
}
}

export function getElement(type){
return document.getElementById(device.screen.width + "-" + type)
}

//Time Draw - START
export function drawTime(now) {
setHours(now);
setMinutes(now);
setSeconds(now);
}

export function setSeconds(now){
if (showSeconds)
{
timeSecEl.style.display= 'inline';
timeSecEl.text = zeroPad(now.getSeconds());
}
else
{
timeSecEl.style.display= 'none';
}
}

export function setMinutes(now){
timeMinuteEl.text = zeroPad(now.getMinutes());
}

export function setHours(now) {
var hours = now.getHours();
let clockFormat = timeFormat;
if(timeFormat === "auto")
{
clockFormat = preferences.clockDisplay;
}

if (clockFormat === "12h") {
// 12h format
if (isAmPm) {
if (hours < 12) {
timeAmPmEl.text = " AM";
} else {
timeAmPmEl.text = " PM";
}
timeAmPmEl.style.display= 'inline';
}
else
{
timeAmPmEl.style.display= 'none';
}

if (hours === 0)
{
hours = 12;
} else if (hours > 12) {
hours = hours - 12;
}
} else {
// 24h format
timeAmPmEl.style.display= 'none';
}

if(showLeadingZero)
{
timeHourEl.text = zeroPad(hours);
}
else
{
timeHourEl.text = hours;
}
}
//Time Draw - END

export function zeroPad(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}

 

clock.ontick = (evt) => {
time.drawTime(evt.date);
}

Best Answer
0 Votes

That happens routinely on the simulator. Have you observed it on a physical watch?

Peter McLennan
Gondwana Software
Best Answer
0 Votes