The two functions described previously return K_OK if successful and K_EFAULT if the data is outside the actor's address space. The following code example illustrates the use of these two general functions:
#include <stdio.h>
#include <stdlib.h>
#include <chorus.h>
int main( )
{
KnTimeVal time;
int result;
result = sysTime(&time);
if (result != K_OK) {
fprintf(stderr, "error on sysTime %s\n", strSysError(result));
exit(1);
}
printf("system time: %d seconds and %d nanoseconds\n",
time.tmSec, time.tmNSec);
result = sysTimeGetRes(&time);
if (result != K_OK) {
fprintf(stderr, "error on sysTime %s\n", strSysError(result));
exit(1);
}
printf("time resolution: %d seconds and %d nanoseconds\n",
time.tmSec, time.tmNSec);
}
This program produces the following output:
neon time1_u started aid = 23 system time: 12013 seconds and 240000000 nanoseconds time resolution: 0 seconds et 10000000 nanoseconds |