libexplain  1.4.D001
Functions
libexplain/buffer/timespec.c File Reference
#include <libexplain/ac/limits.h>
#include <libexplain/ac/math.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/ac/string.h>
#include <libexplain/ac/sys/stat.h>
#include <libexplain/buffer/long.h>
#include <libexplain/buffer/pointer.h>
#include <libexplain/buffer/time_t.h>
#include <libexplain/buffer/timespec.h>
#include <libexplain/is_efault.h>
#include <libexplain/option.h>

Go to the source code of this file.

Functions

static void print_longish (explain_string_buffer_t *sb, long x)
static void print (explain_string_buffer_t *sb, const struct timespec *data)
void explain_buffer_timespec (explain_string_buffer_t *sb, const struct timespec *data)
void explain_buffer_timespec_array (explain_string_buffer_t *sb, const struct timespec *data, unsigned data_size)
void explain_parse_timespec_or_die (const char *text, const char *caption, struct timespec *result)

Function Documentation

void explain_buffer_timespec ( explain_string_buffer_t sb,
const struct timespec *  data 
)

The explain_buffer_timespec function may be used to print a representation of a timespec structure.

Parameters:
sbThe string buffer to print into.
dataThe timespec structure to be printed.

Definition at line 132 of file timespec.c.

void explain_buffer_timespec_array ( explain_string_buffer_t sb,
const struct timespec *  data,
unsigned  data_size 
)

The explain_buffer_timespec_array function may be used to print a representation of a timespec structure.

Parameters:
sbThe string buffer to print into.
dataThe timespec structure to be printed.
data_sizeThe number of elements in the array.

Definition at line 143 of file timespec.c.

void explain_parse_timespec_or_die ( const char *  text,
const char *  caption,
struct timespec *  result 
)

The explain_parse_timespec_or_die function is used to parse some text, to extract a timespec value. It could be a floating point number of seconds, it coule be one of the UTIME_* values, it could be free text as permitted by explain_parse_time_t

On error, ithis function does not return, but errors out using the usual libexplain error handling.

Parameters:
textThe text string to be parsed.
captionadditionl context for fatal error message, if necessary
resultwhere to put the answer on success

Definition at line 165 of file timespec.c.

static void print ( explain_string_buffer_t sb,
const struct timespec *  data 
) [static]

Quoting utimensat(2): "If the tv_nsec field of one of the timespec structures has the special value UTIME_NOW, then the corresponding file timestamp is set to the current time. If the tv_nsec field of one of the timespec structures has the special value UTIME_OMIT, then the corresponding file timestamp is left unchanged. In both of these cases, the value of the corresponding tv_sec field is ignored."

Definition at line 56 of file timespec.c.

static void print_longish ( explain_string_buffer_t sb,
long  x 
) [static]

The print_longish function is used to print a value from within a struct timespec, taking into account the weird values use by futimens and utimensat

Definition at line 39 of file timespec.c.