Mercurial > molko
comparison src/core/clock.h @ 59:52792b863ff7
misc: separate core from game
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 21 Jan 2020 12:42:33 +0100 |
parents | src/clock.h@b815621df3e3 |
children | 6203e1ac9b18 |
comparison
equal
deleted
inserted
replaced
58:d7d88ac30611 | 59:52792b863ff7 |
---|---|
1 /* | |
2 * clock.h -- track elapsed time | |
3 * | |
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr> | |
5 * | |
6 * Permission to use, copy, modify, and/or distribute this software for any | |
7 * purpose with or without fee is hereby granted, provided that the above | |
8 * copyright notice and this permission notice appear in all copies. | |
9 * | |
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 */ | |
18 | |
19 #ifndef MOLKO_CLOCK_H | |
20 #define MOLKO_CLOCK_H | |
21 | |
22 /** | |
23 * \file clock.h | |
24 * \brief Track elapsed time. | |
25 */ | |
26 | |
27 /** | |
28 * \brief Clock structure. | |
29 */ | |
30 struct clock { | |
31 unsigned int ticks; /*!< time point on initialization */ | |
32 }; | |
33 | |
34 /** | |
35 * Start the clock and track elapsed time. | |
36 * | |
37 * \pre clock != NULL | |
38 * \param clock the clock | |
39 */ | |
40 void | |
41 clock_start(struct clock *clock); | |
42 | |
43 /** | |
44 * Tell the measured time. | |
45 * | |
46 * \pre clock != NULL | |
47 * \param clock the clock | |
48 * \return the elapsed time in milliseconds | |
49 */ | |
50 unsigned int | |
51 clock_elapsed(const struct clock *clock); | |
52 | |
53 #endif /* !MOLKO_CLOCK_H */ |