#include <tsci2.h>
#include <stdint.h>
int tsci2_ticks2timeval(uint64_t ticks, struct timeval *tv, tsci2_context context);
tsci2_ticks2timeval converts the given ticks value to the UNIX timeval format, based on the given context. If context is set to NULL, it uses the default tsci2 library internal context.
The following code shows how to use tsci2_ticks2timeval().
#include <stdio.h>
#include <tsci2.h>
#include <stdint.h>
#include <time.h>
int main(int argc, char **argv) {
int preferred_methods, method;
tsci2_context cxt;
uint64_t ticks;
struct timeval tv;
preferred_methods = TSCI2_DAEMON | TSCI2_FALLBACK;
method = tsci2_init(preferred_methods);
if ( method == TSCI2_ERROR )
printf("Error initializing tsci2 library!\n");
ticks = tsci2_getticks();
tsci2_ticks2timeval(ticks, &tv, NULL);
tsci2_shutdown();
}