On Fri, 23 Jan 2015 20:18:45 -0600 Rob Landley <[email protected]> wrote:

> On 01/22/15 23:11, enh wrote:
> > This probably only seems worthwhile to those of us who spend a large
> > part of every day staring at strace output, but in case you're
> > interested...
> > 
> > Before (on a device with only one RTC):
> ...
> > diff --git a/toys/pending/hwclock.c b/toys/pending/hwclock.c
> > index 003174f..04f4770 100644
> > --- a/toys/pending/hwclock.c
> > +++ b/toys/pending/hwclock.c
> > @@ -35,6 +35,7 @@ static int check_hctosys(struct dirtree* node)
> >    FILE *fp;
> > 
> >    if (!node->parent) return DIRTREE_RECURSE;
> > +  if (!dirtree_notdotdot(node)) return 0;
> > 
> >    snprintf(toybuf, sizeof(toybuf), "/sys/class/rtc/%s/hctosys",
> > node->name); fp = fopen(toybuf, "r");
> 
> 
> I'd actually like to follow your suggestion do the counting based
> version, if I can assume that the rtcs aren't sparse (I.E. if
> /sys/class/rtc/rtc3 doesn't exist, then there isn't an rtc4 or higher
> either, so I can stop at the first one that isn't there).
> 
> Do we have hot-unpluggable realtime clocks?

This might count.  It's entirely possible to have a bunch of them
plugged in.  I may even get one some day.  I don't intend to actually
hot plug it though.  I do intend to have it on a device with another
realtime clock, coz they designers neglected to provide so much as a
place to hook up a battery to the other real time clock.  This one has a
battery, it will keep time when the other one doesn't have power.

https://www.olimex.com/Products/Modules/Time/MOD-RTC/open-source-hardware

So in theory, yes we can have multiple hot-unplugabble realtime clocks,
in practice, I doubt it will ever be an issue.

-- 
A big old stinking pile of genius that no one wants
coz there are too many silver coated monkeys in the world.

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to