Re: updating the RTC automagically

Ulrich Windl (ulrich.windl@rz.uni-regensburg.de)
Fri, 19 Nov 1999 08:10:25 +0200


On 18 Nov 99, at 14:15, Guest section DW wrote:

> On Tue, Nov 16, 1999 at 09:16:36AM +0200, Ulrich Windl wrote:
>
> : I investigated what would be needed to set the RTC when the system
> : time changes. First the inverse function for mktime() is needed (i.e.
> : convert UNIX time to days, hours, months, etc.) Then the function to
> : set the RTC would have to be extended to set _all_ the values, not
> : just minute and second.
> :
> : Should I take the date conversion routine from the C library (i.e.
> : copy the code)?
>
> Sounds like a bad idea.

Two people told me it's a bad idea so far.

>
> (i) The function exists already and lives in user space - hwclock.
> (ii) This would add a very large amount of bloat without any
> increase in functionality.

I think it would be a great chance to fix hardware dependent things
where it is the best place. What can hwclock do that the kernel
can't, or: How can hwclock set the kernel, if the kernel can't. Would
you implement code for any of the platforms using #ifdef or what?

> (iia) This would add a maintenance duty to update kernel data
> each time some political body takes a decision about when DST starts, etc.

It wouldn't be much different from now. Just imagine if you set the
time (maybe using settimeofday()), the kernel will the timezone it
knows about to update the clock. I don't want to put the DST
decision logic into the kernel, just the timezone offset.

The latter is needed by DOSish filesystems anyway.

>
> I hope you realize that libc uses /etc/localtime which points at
> some file in /usr/share/zoneinfo or so, and since one cannot access
> such files from the kernel, they would have to be compiled into the kernel.

I hope you realize that timezone is basically a number ;-)

> Even if a configuration option selects the part you need, this would
> still add more than a megabyte to the kernel source.

I had a kilobytes or something like that in mind, with the
possibility to simplyfy some other stuff. Maybe really have a look
to the current snapshot of PPSkit-0.9.0pre2. You will get a feeling
what parts are missing...

Regards,
Ulrich

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/