Macro

X_TIME_VERSION_MAJOR

#define X_TIME_VERSION_MAJOR 1
Macro

X_TIME_VERSION_MINOR

#define X_TIME_VERSION_MINOR 0
Macro

X_TIME_VERSION_PATCH

#define X_TIME_VERSION_PATCH 0
Struct

XTime

typedef struct XTime_t{
  double seconds;
}XTime;
Struct

timespec

struct timespec start;
Function

x_timer_elapsed

Get the elapsed time since a timer was started.

XTime x_timer_elapsed(const XTimer *t);

Parameters

const XTimer *t
Pointer to an initialized timer.

Returns

Elapsed time as an XTime value.

Function

x_time_milliseconds

Convert a time value to milliseconds.

double x_time_milliseconds(XTime t);

Parameters

XTime t
Time value to convert.

Returns

Time in milliseconds.

Function

x_time_microseconds

Convert a time value to microseconds.

double x_time_microseconds(XTime t);

Parameters

XTime t
Time value to convert.

Returns

Time in microseconds.

Function

x_time_nanoseconds

Convert a time value to nanoseconds.

double x_time_nanoseconds(XTime t);

Parameters

XTime t
Time value to convert.

Returns

Time in nanoseconds.

Function

x_time_diff

Compute the difference between two time values.

XTime x_time_diff(
 XTime end,
 XTime start
);

Parameters

XTime end
End time.
XTime start
Start time.

Returns

Difference between end and start.

Function

x_time_add

Add two time values.

XTime x_time_add(
 XTime a,
 XTime b
);

Parameters

XTime a
First time value.
XTime b
Second time value.

Returns

Sum of a and b.

Function

x_time_sub

Subtract one time value from another.

XTime x_time_sub(
 XTime a,
 XTime b
);

Parameters

XTime a
Minuend time value.
XTime b
Subtrahend time value.

Returns

Result of a minus b.

Function

x_time_equals

Compare two time values for equality.

int32_t x_time_equals(
 XTime a,
 XTime b
);

Parameters

XTime a
First time value.
XTime b
Second time value.

Returns

Non-zero if equal, zero otherwise.

Function

x_time_less_than

Test whether one time value is less than another.

int32_t x_time_less_than(
 XTime a,
 XTime b
);

Parameters

XTime a
First time value.
XTime b
Second time value.

Returns

Non-zero if a < b, zero otherwise.

Function

x_time_greater_than

Test whether one time value is greater than another.

int32_t x_time_greater_than(
 XTime a,
 XTime b
);

Parameters

XTime a
First time value.
XTime b
Second time value.

Returns

Non-zero if a > b, zero otherwise.

Function

x_time_sleep

Sleep the current thread for the specified duration.

void x_time_sleep(XTime t);

Parameters

XTime t
Duration to sleep.
Function

x_time_now

Get the current wall-clock time.

XTime x_time_now(void);

Returns

Current time since the Unix epoch.

Function

x_timer_start

void x_timer_start(XTimer *t);