syscall_time: Handle by McKernel
refs: #1036 Change-Id: Ifa81b613c7ee8d95ae7cdf3dd54643f60526fa73
This commit is contained in:
committed by
Masamichi Takagi
parent
5e760db417
commit
c23bc8d401
47
test/issues/1036/CT_001.c
Normal file
47
test/issues/1036/CT_001.c
Normal file
@ -0,0 +1,47 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include "./test_chk.h"
|
||||
|
||||
#define TEST_NAME "CT_001"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
time_t now;
|
||||
long sys_ret;
|
||||
int ng_flag = 0;
|
||||
|
||||
printf("*** %s start *******************************\n", TEST_NAME);
|
||||
|
||||
/* get seconds since the Epoch by glibc time() */
|
||||
now = time(NULL);
|
||||
|
||||
/* get seconds since the Epoch by syscall_time */
|
||||
sys_ret = syscall(__NR_time, NULL);
|
||||
|
||||
if (now != sys_ret) {
|
||||
/* check again only once */
|
||||
now = time(NULL);
|
||||
if (now != sys_ret) {
|
||||
ng_flag = 1;
|
||||
}
|
||||
}
|
||||
printf("glibc time(): %ld seconds\n", now);
|
||||
printf("sys_time : %ld seconds\n", sys_ret);
|
||||
|
||||
OKNG(ng_flag != 0, "check seconds since the Epoch");
|
||||
printf("*** %s PASSED\n\n", TEST_NAME);
|
||||
|
||||
return 0;
|
||||
|
||||
fn_fail:
|
||||
|
||||
printf("*** %s FAILED\n\n", TEST_NAME);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user