Bug 5426 - Sync the system time with slimserver
: Sync the system time with slimserver
Status: CLOSED FIXED
Product: SB Controller
Classification: Unclassified
Component: Browser
: unspecified
: PC Windows XP
: -- normal (vote)
: 7.0.1
Assigned To: Ben Klaas
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-08 14:51 UTC by Richard Titmuss
Modified: 2008-05-15 12:26 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
non-working patch (2.43 KB, patch)
2008-04-16 13:39 UTC, Ben Klaas
Details | Diff
Updated patch (1.77 KB, patch)
2008-04-17 06:47 UTC, Richard Titmuss
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Titmuss 2007-09-08 14:51:41 UTC
The system time is now set when a player is selected. This should be regularly reset from the server to allow for clock drift, or daylight savings.
Comment 1 Blackketter Dean 2008-01-18 09:56:53 UTC
*** Bug 6649 has been marked as a duplicate of this bug. ***
Comment 2 Blackketter Dean 2008-01-18 09:57:26 UTC
Suggest that we turn on NTP 
Comment 3 Peter Watkins 2008-02-19 09:35:58 UTC
I've been using my JHB more than the MQP Controller due to wireless signal strength issues. This is something I noticed on the JHB; I didn't think to check the MQP. Controller firmware release is r1977.

Over the last few days, the clock on the JHB Controller drifts out of sync from the SC7 host by at least 2 minutes per day. My JHB is generally left in the cradle, with analog clock as the saver, but also with Dim Screen When Charging enabled, so the JHB screen is usually dark. Over the last few days I've only used it a very few minutes each day. Changing players seems to resync the JHB clock with the SC7 host as described by Richard. I suspect that this is tied to the power saving updates, as I had not noticed this before those updates were incorporated. NTP sounds like a good idea, especially if you could use SqueezeNetwork servers for the NTP source so it would "just work" out of the box. Giving the users a choice of timeservers might be nice for privacy and for those without always-on broadband.
Comment 4 Peter Watkins 2008-02-22 10:09:08 UTC
I've also observed this clock drift on my MQP Controller, firmware r1985.
Comment 5 Peter Watkins 2008-02-29 05:00:49 UTC
r2022 -- still a problem. After less than three days, my almost-always-docked Controllers are 11 minutes (JHB) and 15 minutes (MQP) off from system time. I respectfully suggest that this bug should be re-targeted for 7.0 -- think how it will look to new customers for a $300 network-enabled device to keep worse time than the cheapest windup wristwatch.

Full NTP might be overkill. Perhaps Lua code could update the drift file for a regular NTP client? I'm not sure how a "client" NTPd setup on the Controller would affect the time seen when the device wakes up, but I'd think
 1) best option is that the device shows a fairly accurate time the moment it wakes up
 2) decent fallback might be having Jive keep track of the last time the time was synced and at startup (and periodically) connect to wifi and resync the clock with SC7, so at worst, at wake-up there'd be a few seconds of showing the wrong time

Comment 6 Richard Titmuss 2008-02-29 05:08:30 UTC
I think I agree with Peter. Removing target this bug for discussion at triage.
Comment 7 Ben Klaas 2008-02-29 12:16:39 UTC
jive checkin r2083 (7.0 branch) syncs system time with hw clock every 10 minutes to correct for drift

confirmed with debug, these calls were immediately after each other:
Feb 29 13:48:26 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 13:48:26 2008
Feb 29 13:48:31 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 13:48:31 2008

leaving bug open, targetted for 7.0.1 to revisit, as this is a bit of a band-aid fix to the problem of the system clock not keeping good time.
Comment 8 Ben Klaas 2008-02-29 14:44:39 UTC
just an FYI, tracking the 7.0 workaround over the course of a day, it appears the clock drift is not constant.

For my test, I had it running hwclock -s to sync to the hw clock every 36 mins (checkin has it going every 10 mins). In 6 clock resyncs, adjustments were 2, 5, 3, 4, 8, and 1 seconds.
 
# cat /mnt/mmc/log/messages | grep 'hw clock'

Feb 29 13:12:25 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 13:12:25 2008
Feb 29 13:12:27 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 13:12:27 2008

Feb 29 13:48:26 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 13:48:26 2008
Feb 29 13:48:31 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 13:48:31 2008

Feb 29 14:24:30 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 14:24:30 2008
Feb 29 14:24:33 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 14:24:33 2008

Feb 29 15:00:32 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 15:00:32 2008
Feb 29 15:00:36 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 15:00:36 2008

Feb 29 15:36:35 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 15:36:35 2008
Feb 29 15:36:43 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 15:36:43 2008

Feb 29 16:12:47 (none) user.warn jive: (SqueezeboxJiveApplet.lua:128) - syncing system clock to hw clock: Fri Feb 29 16:12:47 2008
Feb 29 16:12:48 (none) user.warn jive: (SqueezeboxJiveApplet.lua:131) - system clock now synced to hw clock: Fri Feb 29 16:12:48 2008
Comment 9 Ben Klaas 2008-03-01 07:50:07 UTC
FYI- Clock is not off this morning after 18hrs with new code
Comment 10 Richard Titmuss 2008-03-11 13:20:51 UTC
See also bug 7464 for daylight savings.
Comment 11 Ben Klaas 2008-03-19 08:30:47 UTC
removing priorities from all 7.0.1 target bugs for re-prioritizing
Comment 12 Ben Klaas 2008-04-16 13:39:36 UTC
Created attachment 3241 [details]
non-working patch

This is the patch of what I was trying to do with setting up a clock sync with SC/SN every hour. It seems that the closure in Timer() can't use self?

I don't understand how I can accomplish sending a periodic command to the server if I can't pass anything into the function.

Richard, I'm going to assign this to you. Pass back to me after comment.
Comment 13 Richard Titmuss 2008-04-17 06:47:25 UTC
Created attachment 3252 [details]
Updated patch
Comment 14 Richard Titmuss 2008-04-17 06:48:37 UTC
Ben, my attached patch seems to work. Not much different from yours, other than to add a missing , and remove the warn debugs? Not sure why you were having problems.
Comment 15 Ben Klaas 2008-04-17 08:15:01 UTC
when you say "seems to work", does that mean you confirmed the cli command is actually being issued and a return value is coming back from SC?

I'll give your patch a whirl, but while I could show that I was entering the callback function, I was unable to get a confirmation that the command was being issued and returned. In fact, it looked fairly evident that it wasn't being issued.
Comment 16 Richard Titmuss 2008-04-17 08:30:47 UTC
I got debug saying "setting clock to SC/SN time:" every 10 seconds.
Comment 17 Ben Klaas 2008-04-17 08:35:28 UTC
huh...well, your patch works for me too. Bizarre I couldn't get the same behavior from mine. Maybe one of my log:warn() messages was causing something to balk.

I'm not going to worry about it, your patch works and I (mostly) wrote it so I understand it well enough. I'll push the update back to 1hr from 10secs and checkin shortly.
Comment 18 Ben Klaas 2008-04-17 08:38:46 UTC
fixed in 7.0 trunk r2268

while connected to a player, sync time to SC/SN once per hour. If player changes, start a new timer for that player/server and cancel the existing timer sync.
Comment 19 James Richardson 2008-05-06 10:15:46 UTC
Verified 7.0.1 - 19422 Controller r2409

While the Controller does not update the time "instantly" it will update if you switch Music Source or on the 1hour timer as indicated
Comment 20 James Richardson 2008-05-15 12:26:24 UTC
This bug has recently been fixed in the latest release of SqueezeCenter 7.0.1

Please try that version, if you still see the error, then reopen this bug.

To download this version, please navigate to: http://www.slimdevices.com/su_downloads.html