workaround and comment for problems identified by Michael Schwingen.
[openocd.git] / src / helper / time_support.h
blob0407a1c351d5ae3fd992341aff7f21d04bcd0b2e
1 /***************************************************************************
2 * Copyright (C) 2006 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007,2008 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23 #ifndef TIME_SUPPORT_H
24 #define TIME_SUPPORT_H
26 #ifdef TIME_WITH_SYS_TIME
27 # include <sys/time.h>
28 # include <time.h>
29 #else
30 # ifdef HAVE_SYS_TIME_H
31 # include <sys/time.h>
32 # else
33 # include <time.h>
34 # endif
35 #endif
37 extern int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y);
38 extern int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y);
39 extern int timeval_add_time(struct timeval *result, int sec, int usec);
40 /* gettimeofday() timeval in 64 bit ms */
41 extern long long timeval_ms(void);
43 typedef struct duration_s
45 struct timeval start;
46 struct timeval duration;
47 } duration_t;
49 extern int duration_start_measure(duration_t *duration);
50 extern int duration_stop_measure(duration_t *duration, char **text);
52 #endif /* TIME_SUPPORT_H */