explain_adjtime(3)
π explain_adjtime(3) β the vibe guide π
okay bestie, sit down, hydrate, and let me tell you about explain_adjtime β it's the Library Functions Manual entry that decodes your adjtime(2) errors so you actually know what went wrong instead of just staring at -1 like ποΈπποΈ. no cap.
β¨ NAME β¨
explain_adjtime β explain adjtime(2) errors. that's it. that's the whole job. and it does it flawlessly. π
πΈ SYNOPSIS πΈ
#include <libexplain/adjtime.h>
const char *explain_adjtime(const struct timeval *delta, struct timeval
*olddelta);
const char *explain_errno_adjtime(int errnum, const struct timeval
*delta, struct timeval *olddelta);
void explain_message_adjtime(char *message, int message_size, const
struct timeval *delta, struct timeval *olddelta);
void explain_message_errno_adjtime(char *message, int message_size, int
errnum, const struct timeval *delta, struct timeval *olddelta);
four functions. four little icons. all of them here to hold your hand through an error. π«Ά
π¦ DESCRIPTION π¦
These functions may be used to obtain explanations for errors returned by the adjtime(2) system call. basically: the syscall goes wrong, you call one of these, and you get actual words instead of cryptic nothingness. it's giving β¨customer serviceβ¨ but for your C code.
π explain_adjtime
const char *explain_adjtime(const struct timeval *delta, struct timeval
*olddelta);
The explain_adjtime function is used to obtain an explanation of an error returned by the adjtime(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. it over-delivers. we love that for it. π
The errno global variable will be used to obtain the error value to be decoded. so like, it reads errno for you, no extra steps.
- delta β the original delta, exactly as passed to the
adjtime(2)system call. not a copy, not a remix, the exact same one. π― - olddelta β the original olddelta, exactly as passed to the
adjtime(2)system call. same energy. β¨
Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads.
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. so if you're threading, bestie, be careful. this buffer gets recycled FAST. π
Example: This function is intended to be used in a fashion similar to the following example:
if (adjtime(delta, olddelta) < 0)
{
fprintf(stderr, "%s\n", explain_adjtime(delta, olddelta));
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_adjtime_or_die(3) function. iykyk β it does the printing AND the dying for you. iconic.
π explain_errno_adjtime
const char *explain_errno_adjtime(int errnum, const struct timeval
*delta, struct timeval *olddelta);
The explain_errno_adjtime function is used to obtain an explanation of an error returned by the adjtime(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
- errnum β the error value to be decoded, usually obtained from the
errnoglobal variable just before this function is called. This is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. π¨ translation:errnois feral and other libc calls will stomp on it, so you gotta grab it first and hand it over yourself. - delta β the original delta, exactly as passed to the
adjtime(2)system call. - olddelta β the original olddelta, exactly as passed to the
adjtime(2)system call.
Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads.
Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library.
Example: This function is intended to be used in a fashion similar to the following example:
if (adjtime(delta, olddelta) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_adjtime(err, delta, olddelta));
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_adjtime_or_die(3) function.
π explain_message_adjtime
void explain_message_adjtime(char *message, int message_size, const
struct timeval *delta, struct timeval *olddelta);
The explain_message_adjtime function is used to obtain an explanation of an error returned by the adjtime(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
The errno global variable will be used to obtain the error value to be decoded.
- message β the location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. π you bring the buffer, you get the safety. that's the deal.
- message_size β the size in bytes of the location in which to store the returned message.
- delta β the original delta, exactly as passed to the
adjtime(2)system call. - olddelta β the original olddelta, exactly as passed to the
adjtime(2)system call.
Example: This function is intended to be used in a fashion similar to the following example:
if (adjtime(delta, olddelta) < 0)
{
char message[3000];
explain_message_adjtime(message, sizeof(message), delta, olddelta);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_adjtime_or_die(3) function.
π§ explain_message_errno_adjtime
void explain_message_errno_adjtime(char *message, int message_size, int
errnum, const struct timeval *delta, struct timeval *olddelta);
The explain_message_errno_adjtime function is used to obtain an explanation of an error returned by the adjtime(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail.
- message β the location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. π
- message_size β the size in bytes of the location in which to store the returned message.
- errnum β the error value to be decoded, usually obtained from the
errnoglobal variable just before this function is called. This is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. π¨ (yes, again.errnoreally is like that.) - delta β the original delta, exactly as passed to the
adjtime(2)system call. - olddelta β the original olddelta, exactly as passed to the
adjtime(2)system call.
Example: This function is intended to be used in a fashion similar to the following example:
if (adjtime(delta, olddelta) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_adjtime(message, sizeof(message), err, delta, olddelta);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_adjtime_or_die(3) function.
π SEE ALSO π
adjtime(2)β smoothly tune kernel clockexplain_adjtime_or_die(3)β smoothly tune kernel clock and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page, bestie!! π you made it to the end, so proud of you fr fr. this was explain_adjtime(3) from the Library Functions Manual, brought to you by libexplain version 1.4, with copyright held by Peter Miller, 2009. go forth and decode those errors, you absolute legend. π
β¨π¦πΈπ
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2009-2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms