Rev 1099 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1099 | pj | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * (see the web pages for full authors list) |
||
11 | * |
||
12 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
13 | * |
||
14 | * http://www.sssup.it |
||
15 | * http://retis.sssup.it |
||
16 | * http://shark.sssup.it |
||
17 | */ |
||
18 | |||
19 | /* |
||
20 | * Copyright (C) 2000 Paolo Gai |
||
21 | * |
||
22 | * This program is free software; you can redistribute it and/or modify |
||
23 | * it under the terms of the GNU General Public License as published by |
||
24 | * the Free Software Foundation; either version 2 of the License, or |
||
25 | * (at your option) any later version. |
||
26 | * |
||
27 | * This program is distributed in the hope that it will be useful, |
||
28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
30 | * GNU General Public License for more details. |
||
31 | * |
||
32 | * You should have received a copy of the GNU General Public License |
||
33 | * along with this program; if not, write to the Free Software |
||
34 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
35 | * |
||
36 | * |
||
1547 | pj | 37 | * CVS : $Id: time.c,v 1.2 2005-01-08 14:31:38 pj Exp $ |
1099 | pj | 38 | * |
39 | * Timer correctness test |
||
40 | */ |
||
41 | |||
42 | #include "kernel/kern.h" |
||
43 | |||
44 | #define NT 10 |
||
45 | |||
46 | int main(int argc, char **argv) |
||
47 | { |
||
48 | struct timespec t[NT]; |
||
49 | int i; |
||
50 | |||
51 | cprintf("Timer correctness test (1 second).\n"); |
||
52 | |||
53 | for (i=0; i<NT; i++) NULL_TIMESPEC(&t[i]); |
||
54 | |||
55 | do { |
||
56 | for (i=0; i<NT-1; i++) t[i+1] = t[i]; |
||
57 | |||
58 | sys_gettime(&t[0]); |
||
59 | |||
60 | if (TIMESPEC_A_LT_B(&t[0],&t[1])) { |
||
61 | for (i=0; i<NT; i++) |
||
62 | cprintf("%d %ld\n",i, t[i].tv_nsec); |
||
1547 | pj | 63 | exit(0); |
1099 | pj | 64 | } |
65 | } while (t[0].tv_sec < 1); |
||
66 | |||
67 | return 0; |
||
68 | } |
||
69 |