ELinks 0.16.1.1
timeval_T Struct Reference

Redefine a timeval that has all fields signed so calculations will be simplified on rare systems that define timeval with unsigned fields. More...

#include <time.h>

Data Fields

long sec
long usec

(Note that these are not member symbols.)

timeval_Ttimeval_now (timeval_T *t)
 Get the current time.
timeval_Ttimeval_sub_interval (timeval_T *t, timeval_T *interval)
 Subtract an interval to a timeval, it ensures that result is never negative.
timeval_Ttimeval_sub (timeval_T *res, timeval_T *older, timeval_T *newer)
timeval_Ttimeval_add (timeval_T *res, timeval_T *base, timeval_T *t)
timeval_Ttimeval_add_interval (timeval_T *t, timeval_T *interval)
timeval_Ttimeval_from_double (timeval_T *t, double x)
timeval_Ttimeval_from_milliseconds (timeval_T *t, milliseconds_T milliseconds)
timeval_Ttimeval_from_seconds (timeval_T *t, long seconds)
milliseconds_T timeval_to_milliseconds (timeval_T *t)
long timeval_to_seconds (timeval_T *t)
int timeval_is_positive (timeval_T *t)
void timeval_limit_to_zero_or_one (timeval_T *t)
 Be sure timeval is not negative.
int timeval_cmp (timeval_T *t1, timeval_T *t2)
 Compare time values.
int timeval_div_off_t (off_t n, timeval_T *t)
#define timeval_copy(dst, src)

Detailed Description

Redefine a timeval that has all fields signed so calculations will be simplified on rare systems that define timeval with unsigned fields.

Bug
923: Assumes time_t values fit in long. (This structure is used for both timestamps and durations.)

◆ timeval_add()

timeval_T * timeval_add ( timeval_T * res,
timeval_T * base,
timeval_T * t )
related

◆ timeval_add_interval()

timeval_T * timeval_add_interval ( timeval_T * t,
timeval_T * interval )
related

◆ timeval_cmp()

int timeval_cmp ( timeval_T * t1,
timeval_T * t2 )
related

Compare time values.

Returns
1 if t1 > t2; -1 if t1 < t2; 0 if t1 == t2.

◆ timeval_copy

#define timeval_copy ( dst,
src )
related
Value:
copy_struct(dst, src)
#define copy_struct(destination, source)
Definition generic.h:117

◆ timeval_div_off_t()

int timeval_div_off_t ( off_t n,
timeval_T * t )
related

◆ timeval_from_double()

timeval_T * timeval_from_double ( timeval_T * t,
double x )
related

◆ timeval_from_milliseconds()

timeval_T * timeval_from_milliseconds ( timeval_T * t,
milliseconds_T milliseconds )
related

◆ timeval_from_seconds()

timeval_T * timeval_from_seconds ( timeval_T * t,
long seconds )
related
Bug
923: Assumes time_t values fit in long. (This function is used for both timestamps and durations.)

◆ timeval_is_positive()

int timeval_is_positive ( timeval_T * t)
related

◆ timeval_limit_to_zero_or_one()

void timeval_limit_to_zero_or_one ( timeval_T * t)
related

Be sure timeval is not negative.

◆ timeval_now()

timeval_T * timeval_now ( timeval_T * t)
related

Get the current time.

It attempts to use available functions, granularity may be as worse as 1 second if time() is used.

◆ timeval_sub()

timeval_T * timeval_sub ( timeval_T * res,
timeval_T * older,
timeval_T * newer )
related

◆ timeval_sub_interval()

timeval_T * timeval_sub_interval ( timeval_T * t,
timeval_T * interval )
related

Subtract an interval to a timeval, it ensures that result is never negative.

◆ timeval_to_milliseconds()

milliseconds_T timeval_to_milliseconds ( timeval_T * t)
related

◆ timeval_to_seconds()

long timeval_to_seconds ( timeval_T * t)
related
Bug
923: Assumes time_t values fit in long. (This function is used for both timestamps and durations.)

Field Documentation

◆ sec

long timeval_T::sec

◆ usec

long timeval_T::usec

The documentation for this struct was generated from the following files: