Table of Contents

Name

tsci2_ticks2timeval converts a ticks value to the UNIX timeval format.

Synopsis

#include <tsci2.h>

#include <stdint.h>

int tsci2_ticks2timeval(uint64_t ticks, struct timeval *tv, tsci2_context context);

Description

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.

Return Values

Upon successful completion, tsci2_ticks2timeval() returns 0. Otherwise, TSCI2_ERROR is returned..

Examples

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();

}

Author

Xun Luo (sherwoodluo@users.sourceforge.net)

See Also

tsci2d(8) , tsci2demo(1) , tsci2_measure(1) , tsci2_init(3) , tsci2_shutdown(3) , tsci2_alloc_context(3) , tsci2_free_context(3) , tsci2_get_default_context(3) , tsci2_gettimeofday(3) , tsci2_ticks(3) .


Table of Contents