ADJTIME(2)
π ADJTIME(2) π
okay bestie, so this is a system call from the System Calls Manual β and it lives in the Standard C Library (libc, -lc), which is giving "the blueprint, the moment, the canon." it's called adjtime and it's here to correct the time to allow synchronization of the system clock. literally the clock's little glow-up era β¨
πΈ SYNOPSIS πΈ
#include <sys/time.h>
int
adjtime(const struct timeval *delta, struct timeval *olddelta);
β¨ DESCRIPTION β¨
so the adjtime() system call makes small adjustments to the system time β like the time you get back from gettimeofday(2) β and it either advances or retards it by however much you put in the timeval delta. π°οΈ
- if
deltais negative, the clock gets slowed down β it's incremented more slowly than normal until the correction is done. - if
deltais positive, a larger increment than normal is used instead.
the skew used to perform the correction is generally a fraction of one percent. so yeah, the time is always a monotonically increasing function β it never, ever goes backwards, no cap, that's the whole vibe. π
β οΈ important bestie: a time correction from an earlier call toadjtime()might not be finished when you calladjtime()again. ifolddeltais not a null pointer, then on return the structure it points to will hold the number of microseconds still to be corrected from the earlier call. so you can peek at the leftover to-do list. π
this call is what time servers use to synchronize the clocks of computers in a local area network. such time servers would slow down the clocks of some machines and speed up the clocks of others, bringing them all to the average network time. group chat but for clocks, honestly. π«Ά
π and yes, the adjtime() system call is restricted to the super-user. root only. periodt.
π« RETURN VALUES π«
adjtime()returns the value0if it ate. π- otherwise it returns the value
-1and the global variableerrnois set to indicate the error. π
π ERRORS π
the adjtime() system call will fail if:
[EFAULT]β an argument points outside the process's allocated address space. π[EPERM]β the process's effective user ID is not that of the super-user. bestie you are simply not on the list. π
π¦ SEE ALSO π¦
date(1)gettimeofday(2)timed(8)timedc(8)
and also, from R. Gusella and S. Zatti: TSP: The Time Synchronization Protocol for UNIX 4.3BSD. πβ¨
π HISTORY π
the adjtime() system call appeared in 4.3BSD. it's been iconic since day one, fr fr. β
mwah π that's the whole page! this one's a Debian classic, dated June 4, 1993, and it's the ADJTIME(2) page from the System Calls Manual. slay, stay synchronized, and remember: always check your olddelta. ππ¦πΈ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms