OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [cris/] [c/] [gettod.c] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 jlechner
/* Basic time functionality test.  */
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <time.h>
5
#include <sys/time.h>
6
int
7
main (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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.