summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_rtc.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r299064royger2016-09-301-1/+1
| | | | rtc: fix inverted resolution check
* Core structure and functions to support a feed-forward clock within the kernel.lstewart2011-11-191-1/+14
| | | | | | | | | | | | | | | | | Implement ffcounter, a monotonically increasing cumulative counter on top of the active timecounter. Provide low-level functions to read the ffcounter and convert it to absolute time or a time interval in seconds using the current ffclock estimates, which track the drift of the oscillator. Add a ring of fftimehands to track passing of time on each kernel tick and pick up updates of ffclock estimates. Committed on behalf of Julien Ridoux and Darryl Veitch from the University of Melbourne, Australia, as part of the FreeBSD Foundation funded "Feed-Forward Clock Synchronization Algorithms" project. For more information, see http://www.synclab.org/radclock/ Submitted by: Julien Ridoux (jridoux at unimelb edu au)
* Add the half of time-of-day clock resolution when we adjust system time fromjkim2010-08-121-1/+7
| | | | | | | | | | time-of-day clock or vice versa. For x86 systems, RTC resolution is one second and we used to lose up to one second whenever we initialize system time from RTC or write system time back to RTC. With this change, margin of error per conversion is roughly between -0.5 and +0.5 second rather than between -1 and 0 second. Note that it does not take care of errors from getnanotime(9) (which is up to 1/hz second) or CLOCK_GETTIME() latency. These are just too expensive to correct and it is not worthy of the cost.
* Provide description for 'machdep.disable_rtc_set' sysctl. Clean up style(9)jkim2010-08-121-19/+13
| | | | nits. Remove a redundant return statement and an unnecessary variable.
* Clean up MI inittodr(9) and kill noop code.jkim2009-03-231-21/+13
| | | | | | | | | | It was derived from i386 version long ago but never resync'ed again. Originally, i386 version compared the current time from realtime clock with time_second (which was just `time' in the old days). When this MI version was written, it was wrongly compared against `base' AND never used because of a bug (typo?) in the code. This check was killed in i386 version when home-rolled calendaric calculation was removed. Now, we just remove the code here as well to make the code simpler.
* int foo(void) is the proper ANSI function definition when there's noimp2009-02-031-1/+1
| | | | parameters. Use it for resettodr().
* Now that all platforms use genclock, shuffle things around slightlyphk2008-04-221-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for better structure. Much of this is related to <sys/clock.h>, which should really have been called <sys/calendar.h>, but unless and until we need the name, the repocopy can wait. In general the kernel does not know about minutes, hours, days, timezones, daylight savings time, leap-years and such. All that is theoretically a matter for userland only. Parts of kernel code does however care: badly designed filesystems store timestamps in local time and RTC chips almost universally track time in a YY-MM-DD HH:MM:SS format, and sometimes in local timezone instead of UTC. For this we have <sys/clock.h> <sys/time.h> on the other hand, deals with time_t, timeval, timespec and so on. These know only seconds and fractions thereof. Move inittodr() and resettodr() prototypes to <sys/time.h>. Retain the names as it is one of the few surviving PDP/VAX references. Move startrtclock() to <machine/clock.h> on relevant platforms, it is a MD call between machdep.c/clock.c. Remove references to it elsewhere. Remove a lot of unnecessary <sys/clock.h> includes. Move the machdep.disable_rtc_set sysctl to subr_rtc.c where it belongs. XXX: should be kern.disable_rtc_set really, it's not MD.
* Use utc_offset() where applicable, and hide the internals of itphk2006-10-021-6/+2
| | | | as static variables.
* Second part of a little cleanup in the calendar/timezone/RTC handling.phk2006-10-021-147/+0
| | | | | | | | | | | Split subr_clock.c in two parts (by repo-copy): subr_clock.c contains generic RTC and calendaric stuff. etc. subr_rtc.c contains the newbus'ified RTC interface. Centralize the machdep.{adjkerntz,disable_rtc_set,wall_cmos_clock} sysctls and associated variables into subr_clock.c. They are not machine dependent and we have generic code that relies on being present so they are not even optional.
* Remove more straggling CPU_ macro referencesphk2006-05-111-4/+4
|
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Use __FBSDID().obrien2003-06-111-2/+4
|
* Split the global timezone structure into two integer fields tophk2003-02-031-2/+2
| | | | | | | | | | prevent the compiler from optimizing assignments into byte-copy operations which might make access to the individual fields non-atomic. Use the individual fields throughout, and don't bother locking them with Giant: it is no longer needed. Inspired by: tjr
* Use the CPU_* OID constants instead of OID_AUTO for the clock-relatedtmm2002-08-071-3/+6
| | | | sysctls for compatability with old applications.
* Add a generic implementation of inittodr() and resettodr(), as well astmm2002-04-041-0/+316
a set of helper routines to deal with real-time clocks. The generic functions access the clock diver using a kobj interface. This is intended to reduce code reduplication and make it easy to support more than one clock model on a single architecture. This code is currently only used on sparc64, but it is planned to convert the code of the other architectures to it later.
OpenPOWER on IntegriCloud