Daniel Dickinson <l...@cshore.thecshore.com> [2016-10-20 16:47:09]:

> On Wed, 19 Oct 2016 22:05:43 +0200
> Petr Štetiar <yn...@true.cz> wrote:
> 
> > Felix Fietkau <n...@nbd.name> [2016-10-19 21:44:06]:
> > 
> > > I'd like to know why you need to use local time for the RTC, I think
> > > that's rather uncommon.  
> > 
> > You mean system time in local time, right? RTC should be in UTC and
> > in current sysftime isn't. Basically sysfixtime should be using
> > hwclock with -u parameter from the same beginning as the kernel
> > doesn't expect time in RTC to be in other timezone.
> > 
> > Believe it or not, I've some users which are used to have system time
> > on their desktop Linux machines in local timezone and they expect the
> > same from the Linux on embedded devices. It's hard, I know :-)
> 
> Have you ever looked at UCI config for /etc/config/system?  There is
> the option to set the system timezone there.  No need to hack hwclock.

I know, that I can't write meaningful commit messages, sorry for that. I'll
try to explain it again.

Please take a look at hwclock, you've to tell it via -u command line option,
that your RTC is keeping time in UTC, otherwise it will happily use whatever
time your system uses and your time is screwed (no time conversion happens).

I've following in the setup script:

  uci set system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
  uci set system.@system[0].zonename='Europe/Prague'

I've this RTC setup:

  rtc-ds1307 3-006f: rtc core: registered mcp7941x as rtc0
  snvs_rtc 20cc000.snvs:snvs-rtc-lp: rtc core: registered 20cc000.snvs:snvs-r 
as rtc1

Then you can experience following (current time is 10:15am):

        $ date
        Fri Oct 21 10:15:07 CEST 2016

        $ hwclock -r -f /dev/rtc0
        Fri Oct 21 08:14:46 2016  0.000000 seconds

        $ hwclock -u -r -f /dev/rtc0
        Fri Oct 21 10:14:46 2016  0.000000 seconds

And after current borken sysfixtime:

        $ /etc/init.d/sysfixtime stop

        $ date
        Fri Oct 21 10:15:25 CEST 2016

        $ hwclock -r -f /dev/rtc0
        Fri Oct 21 10:15:31 2016  0.000000 seconds

Now you've time in your battery backed RTC in CEST timezone instead of UTC. Is
the problem more clear now?

Again, wbut ith my patched sysfixtime, using hwclock -u parameter:

        $ /etc/init.d/sysfixtime stop

        $ date
        Fri Oct 21 10:15:53 CEST 2016

        $ hwclock -r -f /dev/rtc0
        Fri Oct 21 08:15:55 2016  0.000000 seconds

-- ynezz

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to