1 |
/* Creation date: 2005-06-26 18:09:46
|
2 |
* Authors: Don
|
3 |
* Change log:
|
4 |
*/
|
5 |
|
6 |
/* Copyright (c) 2005 Don Owens
|
7 |
All rights reserved.
|
8 |
|
9 |
This code is released under the BSD license:
|
10 |
|
11 |
Redistribution and use in source and binary forms, with or without
|
12 |
modification, are permitted provided that the following conditions
|
13 |
are met:
|
14 |
|
15 |
* Redistributions of source code must retain the above copyright
|
16 |
notice, this list of conditions and the following disclaimer.
|
17 |
|
18 |
* Redistributions in binary form must reproduce the above
|
19 |
copyright notice, this list of conditions and the following
|
20 |
disclaimer in the documentation and/or other materials provided
|
21 |
with the distribution.
|
22 |
|
23 |
* Neither the name of the author nor the names of its
|
24 |
contributors may be used to endorse or promote products derived
|
25 |
from this software without specific prior written permission.
|
26 |
|
27 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
28 |
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
29 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
30 |
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
31 |
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
32 |
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
33 |
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
34 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
35 |
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
36 |
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
37 |
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
38 |
OF THE POSSIBILITY OF SUCH DAMAGE.
|
39 |
*/
|
40 |
|
41 |
#ifndef _CFU_TIME_H_
|
42 |
#define _CFU_TIME_H_
|
43 |
|
44 |
#include <cfu.h>
|
45 |
|
46 |
#include <sys/time.h>
|
47 |
|
48 |
#ifdef __cplusplus
|
49 |
extern "C" {
|
50 |
#endif
|
51 |
|
52 |
struct cfutime;
|
53 |
typedef struct cfutime cfutime_t;
|
54 |
|
55 |
/* Return a new cfutime structure. */
|
56 |
extern cfutime_t *cfutime_new();
|
57 |
|
58 |
/* Start the timer. */
|
59 |
extern void cfutime_begin(cfutime_t *time);
|
60 |
|
61 |
/* Stop the timer. */
|
62 |
extern void cfutime_end(cfutime_t *time);
|
63 |
|
64 |
/* Return the number of seconds elapsed as a double. */
|
65 |
extern double cfutime_elapsed(cfutime_t *time);
|
66 |
|
67 |
/* Deallocate resources allocated for time. */
|
68 |
extern void cfutime_free(cfutime_t *time);
|
69 |
|
70 |
#ifdef __cplusplus
|
71 |
}
|
72 |
#endif
|
73 |
|
74 |
#endif
|