explain_ftime(3)
π explain_ftime(3) β a lil guide from your fave Unix bestie π
Library Functions Manual Β· part of libexplain β¨
okay so bestie, gather round π«Ά this one is all about making ftime(3) errors make sense instead of just yelling errno at you like a cryptic little gremlin. it's giving translator energy, and honestly? iconic.
β¨ NAME β¨
explain_ftime β the function that explains your ftime(3) errors for you π
no cap, that's literally its whole job.
πΈ SYNOPSIS πΈ
#include <libexplain/ftime.h>
const char *explain_ftime(struct timeb *tp);
const char *explain_errno_ftime(int errnum, struct timeb *tp);
void explain_message_ftime(char *message, int message_size, struct timeb
*tp);
void explain_message_errno_ftime(char *message, int message_size, int
errnum, struct timeb *tp);
π¦ DESCRIPTION π¦
so these functions are your lil squad of error-explainers π you use them to get actual explanations for errors that the ftime(3) system call handed back to you. like, the vibe is: the system call said no, and now you wanna know why, in words, in English, fr fr.
π explain_ftime
const char *explain_ftime(struct timeb *tp);
the explain_ftime function gets you an explanation of an error returned by the ftime(3) system call. the least it'll give you is the value of strerror(errno), but usually it goes way harder than that and tells you the actual underlying cause in more detail. main character energy honestly.
the errno global variable is what gets used to grab the error value that's gonna be decoded. so like, it reads the vibes straight from errno π«
tpβ the originaltp, exactly as you passed it to theftime(3)system call. no substitutions, no edits, the real one.
Returns: the message explaining the error. this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. so the next call to any libexplain function that shares this buffer will overwrite it β including calls from other threads. it's a communal lil buffer, and it does not care about your feelings π
Note: this function is not thread safe, because it shares a return buffer across all threads, and lots of other functions in this library do too. so like, be careful out there π«
Example: this function is meant to be used in a fashion similar to the following example:
if (ftime(tp) < 0)
{
fprintf(stderr, "%s\n", explain_ftime(tp));
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_ftime_or_die(3) function π (yes, it does the dying for you, slay)
π explain_errno_ftime
const char *explain_errno_ftime(int errnum, struct timeb *tp);
the explain_errno_ftime function gets you an explanation of an error returned by the ftime(3) system call. again, the least the message will contain is the value of strerror(errno), but usually it does much better and points at the underlying cause in more detail. obsessed.
errnumβ the error value to be decoded, usually grabbed from theerrnoglobal variable right before this function is called. this is necessary if you need to run any code between the system call you're explaining and this function, because a lot of libc functions will mess with the value oferrno. so like, snapshot it first πΈtpβ the originaltp, exactly as passed to theftime(3)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. it 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 (ftime(tp) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_ftime(err, tp));
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_ftime_or_die(3) function β¨
π explain_message_ftime
void explain_message_ftime(char *message, int message_size, struct timeb
*tp);
the explain_message_ftime function gets you an explanation of an error returned by the ftime(3) 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's giving thorough π
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 you supply a suitable message return buffer, this function is thread safe. you did it bestie, you brought your own buffer π«Άmessage_sizeβ the size in bytes of the location in which to store the returned message. so like, how much room you're giving it.tpβ the originaltp, exactly as passed to theftime(3)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (ftime(tp) < 0)
{
char message[3000];
explain_message_ftime(message, sizeof(message), tp);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_ftime_or_die(3) function π
π§ explain_message_errno_ftime
void explain_message_errno_ftime(char *message, int message_size, int
errnum, struct timeb *tp);
the explain_message_errno_ftime function is used to obtain an explanation of an error returned by the ftime(3) 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 full package, no cap.
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 theerrnoglobal 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.tpβ the originaltp, exactly as passed to theftime(3)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (ftime(tp) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_ftime(message, sizeof(message), err, tp);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_ftime_or_die(3) function π
π SEE ALSO π
ftime(3)β return date and timeexplain_ftime_or_die(3)β return date and time and report errors
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page bestie πΈ go forth and explain those errors, you absolute legend π π
β explain_ftime(3), from libexplain version 1.4, copyright (C) 2009 Peter Miller. mwah π
π¦ 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