1/* Basic time functionality test.  */
2#include <stdio.h>
3#include <stdlib.h>
4#include <time.h>
5#include <sys/time.h>
6int
7main (void)
8{
9  struct timeval t_m = {0, 0};
10  time_t t;
11
12  if ((t = time (NULL)) == (time_t) -1
13      || gettimeofday (&t_m, NULL) != 0
14      || t_m.tv_sec == 0
15
16      /* We assume there will be no delay between the time and
17	 gettimeofday calls above, but allow a timer-tick to make the
18	 seconds increase by one.  */
19      || (t != t_m.tv_sec && t+1 != t_m.tv_sec))
20    {
21      printf ("fail\n");
22      exit (1);
23    }
24
25  printf ("pass\n");
26  exit (0);
27}
28