#include <tsci2.h>
int tsci2_init(int methods);
int tsci2_shutdown();
The tsci2_init() function initializes the tsci2 library and the tsci2_shutdown function shuts it down. The initialization will return the current available method, depending on the user preference, access priviledge and whether there is tsci2d timekeeping daemon running.
The methods argument designates user’s preference of timekeeping methods and could be any combination of TSCI2_DAEMON, TSCI2_CLIENT and TSCI2_FALLBACK. tsci2_init will try best to find a match.
If the current available timekeeping method is TSCI2_DAEMON, tsci2_init() will set up shared memory communication with daemon. tsci2_shutdown() will unmap the shared memory.
The following code shows how to use tsci2_init() and tsci2_shutdown().
#include <stdio.h>
#include <tsci2.h>
int main(int argc, char **argv) {
int
preferred_methods, method;
preferred_methods = TSCI2_DAEMON | TSCI2_FALLBACK;
method = tsci2_init(preferred_methods);
if ( method == TSCI2_ERROR )
printf("Error initializing tsci2 library!\n");
tsci2_shutdown();
}