X_TIME_VERSION_MAJOR
#define X_TIME_VERSION_MAJOR 1
STDX - Time Utilities Part of the STDX General Purpose C Library by marciovmf https://github.com/marciovmf/stdx License: MIT
Provides a portable threading abstraction for C programs. Includes Time based comparisson, measurement and arithmetic ooperations
To compile the implementation define X_IMPL_TIME
in one source file before including this header.
#define X_TIME_VERSION_MAJOR 1
#define X_TIME_VERSION_MINOR 0
#define X_TIME_VERSION_PATCH 0
#define X_TIME_VERSION(X_TIME_VERSION_MAJOR *10000+X_TIME_VERSION_MINOR *100+X_TIME_VERSION_PATCH)
typedef struct XTime_t{
double seconds;
}XTime;
struct timespec start;
Get the elapsed time since a timer was started.
XTime x_timer_elapsed(const XTimer *t);
const XTimer *tElapsed time as an XTime value.
Convert a time value to milliseconds.
double x_time_milliseconds(XTime t);
XTime tTime in milliseconds.
Convert a time value to microseconds.
double x_time_microseconds(XTime t);
XTime tTime in microseconds.
Convert a time value to nanoseconds.
double x_time_nanoseconds(XTime t);
XTime tTime in nanoseconds.
Compute the difference between two time values.
XTime x_time_diff(
XTime end,
XTime start
);
Difference between end and start.
Add two time values.
XTime x_time_add(
XTime a,
XTime b
);
Sum of a and b.
Subtract one time value from another.
XTime x_time_sub(
XTime a,
XTime b
);
Result of a minus b.
Compare two time values for equality.
int32_t x_time_equals(
XTime a,
XTime b
);
Non-zero if equal, zero otherwise.
Test whether one time value is less than another.
int32_t x_time_less_than(
XTime a,
XTime b
);
Non-zero if a < b, zero otherwise.
Test whether one time value is greater than another.
int32_t x_time_greater_than(
XTime a,
XTime b
);
Non-zero if a > b, zero otherwise.
Sleep the current thread for the specified duration.
void x_time_sleep(XTime t);
XTime tGet the current wall-clock time.
XTime x_time_now(void);
Current time since the Unix epoch.
void x_timer_start(XTimer *t);