1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 22:05:07 +00:00
serenity/Libraries/LibC/sys
Nico Weber 323e727a4c Kernel+LibC: Add adjtime(2)
Most systems (Linux, OpenBSD) adjust 0.5 ms per second, or 0.5 us per
1 ms tick. That is, the clock is sped up or slowed down by at most
0.05%.  This means adjusting the clock by 1 s takes 2000 s, and the
clock an be adjusted by at most 1.8 s per hour.

FreeBSD adjusts 5 ms per second if the remaining time adjustment is
>= 1 s (0.5%) , else it adjusts by 0.5 ms as well. This allows adjusting
by (almost) 18 s per hour.

Since Serenity OS can lose more than 22 s per hour (#3429), this
picks an adjustment rate up to 1% for now. This allows us to
adjust up to 36s per hour, which should be sufficient to adjust
the clock fast enough to keep up with how much time the clock
currently loses. Once we have a fancier NTP implementation that can
adjust tick rate in addition to offset, we can think about reducing
this.

adjtime is a bit old-school and most current POSIX-y OSs instead
implement adjtimex/ntp_adjtime, but a) we have to start somewhere
b) ntp_adjtime() is a fairly gnarly API. OpenBSD's adjfreq looks
like it might provide similar functionality with a nicer API. But
before worrying about all this, it's probably a good idea to get
to a place where the kernel APIs are (barely) good enough so that
we can write an ntp service, and once we have that we should write
a way to automatically evaluate how well it keeps the time adjusted,
and only then should we add improvements ot the adjustment mechanism.
2020-11-10 19:03:08 +01:00
..
arch/i386 Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
cdefs.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
file.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
internals.h LibC: Move C++ABI functions to cxxabi.cpp, typecheck cxa_atexit 2020-08-12 20:40:59 +02:00
ioctl.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
ioctl_numbers.h LibC: Implement tcflush(3) 2020-07-11 11:33:33 +02:00
mman.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
param.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
ptrace.cpp Everywhere: Fix typos 2020-10-02 16:03:17 +02:00
ptrace.h Kernel: More PID/TID typing 2020-08-10 11:51:45 +02:00
resource.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
select.cpp Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
select.h LibC: Implement pselect 2020-06-22 16:00:20 +02:00
socket.cpp Kernel+LibC: Use uintptr_t as the main type in the syscall interface 2020-10-12 19:53:25 +02:00
socket.h LibC: We still need to use NULL (not nullptr) in C headers 2020-10-14 13:57:51 +02:00
stat.h LibC: Move stat(), lstat() and fstat() to <sys/stat.h> 2020-08-11 20:29:14 +02:00
sysmacros.h Meta: Add a script check the presence of "#pragma once" in header files 2020-05-29 07:59:45 +02:00
time.h Kernel+LibC: Add adjtime(2) 2020-11-10 19:03:08 +01:00
times.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
types.h LibC: Add SCM_RIGHTS to sockets.h and caddr_t to types.h 2020-09-27 01:02:11 +02:00
uio.cpp Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
uio.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
un.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
utsname.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
wait.cpp Kernel: Move headers intended for userspace use into Kernel/API/ 2020-07-04 17:22:23 +02:00
wait.h Kernel+LibC: Add sys$waitid(), and make sys$waitpid() wrap it 2020-02-05 18:14:37 +01:00