Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#319 digital clock applet is one minute slow

closed-fixed
martyj19
lxpanel (194)
2
2010-12-01
2010-12-01
paul
No

I run openntpd so when I browse to http://wwp.greenwichmeantime.co.uk/ and type date in a console, the two times agree.

However, I have a digital clock applet in my lxpanel and use the format

%l:%M %a %e %b

If I include ":%S" the digital clock looks fine but when I remove the seconds and close the settings windows, the digital clock "minutes" field does not update until the "next-but-one top of the minute" but it updates to exactly one minute behind. It then updates "on the minute" but remains one minute behind system time.

e.g.

11:10:05 digital clock including "%S" is showing correct minute (10)
11:10:10 I remove "%S" from clock settings window and close the window, lxpanel clock correctly shows 11:10
11:11:00 gmt website and "date" agree, lxpanel clock still showing 11:10
11:12:00 gmt website and "date agree, lxpanel updates to 11:11

I don't know when this behaviour started as I never have displayed seconds on my panel clock and I'm sure it used to synchronise with the FM radio timing "pips", or I'm going mad :cry:

Arch Linux package: lxpanel-0.5.6-1-x86_64 updated on my system 13th October

I think dclock.c line 154 is the problem, should end in " - 1" (years since I programmed in C)

time_t seconds = 60 - (current_time.tv_sec - (current_time.tv_sec / 60) * 60) - 1;

e.g. if "current_time.tv_sec" is 15 seconds past midnight, won't that mean "seconds" is set to 44, so the next timer interrupt happens 44 seconds later at 00:00:59 instead of 00:01:00?

Discussion

  • paul
    paul
    2010-12-01

    • priority: 5 --> 2
     
  • paul
    paul
    2010-12-01

    should end in " - 1"

    missed out a question mark. I think removing that would help

     
  • martyj19
    martyj19
    2010-12-01

    Fixed in git commit 47f0a0fb9d098d3b84e1c397131286c552ba2886

    I think what I meant to do was "+ 1" to have the timer expire one second after the minute boundary to ensure that the clock update had happened. This can be done if there is any further trouble.

     
  • martyj19
    martyj19
    2010-12-01

    • assigned_to: nobody --> martyj19
    • status: open --> closed-fixed