On 18/10/2017 at 23:56:38 +0200, Pavel Machek wrote: > > Some RTCs will tell you when they lost time/time accuracy and this > > should be properly reported by the driver. If not, this has to be > > implemented. > > How is it reported to the userspace? > Userspace will get -EINVAL when using the RTC_RD_TIME ioctl. The kernel also get the same error when reading the time from the RTC. > > For anything else, it is probably the job of userspace to try to be > > clever. > > Userspace would be fine with me, but as far as I can tell, there's no > good way to do it in userspace. > > My proposal would be: kernel keeps accuracy for timeofday. > > If RTC says time is bad, accuracy is set to ~0. > > settimeofday sets accuracy to 0 (completely accurate). > > new_settimeofday gets new argument, accuracy. > > new_gettimofday returns accuracy, too. > > Does that sound sane? I'm not sure what other interfaces need to be extended. > > Best regards, > Pavel > > -- > (english) http://www.livejournal.com/~pavelmachek > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com