October 22, 2017, 08:44:26 am
Pages: [1]
Author Topic: FYI - Time sync (again)  (Read 1209 times)
Sr. Member
Posts: 378

View Profile
« on: April 03, 2012, 05:19:52 am »

As an FYI, I have solved the last (?) lingering problem with my method of time-sync for the OSD - namely, the problem of Daylight Saving Time.  The OSD has a weird notion of time - that is, it thinks it is on UTC, but is, in reality, on local time.  It is local time masquerading as UTC.  This means that it can never (in the shipped configuration) handle the switches to and from DST (BST for our UK readers).  That is, it cannot handle it w/o manual intervention.

However, I have found that by copying over a valid timezone file (in my case, the America/New_York file) from another Linux system, I can handle this, since the timezone file is DST-aware.  Thus, the command line(s) that I use to do the time-sync is:

# I copied the New_York file to the /mnt/OSD directory...
set -- $(TZ=/mnt/OSD/New_York rdate -p some.reliable.timeserver)
date -D "%b %d %H:%M:%S %Y" -s "$2 $3 $4 $5"

But I have a couple of questions:

1) Wouldn't it be nice if I could make this permanent?  I.e., actually run the system on New York time?  Has anyone done this?  (see comment #2 at end)

2) I've heard that other people have managed to get ntp working on the OSD...  How do they handle the timezone and DST issues?

Finally, a couple of "Gee, now that I think about it, I could have done..." comments:

1) The above method (using two commands to do it) was necessary in the past because of the limitations of the busybox "rdate" command, but may not be necessary any more.  It may be possible to do it in one line - i.e., using rdate directly to set the time.  I'll have to check this.

2) I think the method for setting the timezone is to make a file (or link) at /etc/timezone that is the timezone file.  Oh, but the problem with this is that /etc is read-only.  One could use the "mount --bind" hack to get around this, but the problem with that is that it may be too late - i.e., if you do it in rc.user, most of the system daemons (in particular, the scheduler) will have already started and they may not be smart enough to notice that the system's idea of time has changed.  I think that's why I never investigated this seriously.
Pages: [1]
Jump to: