diff options
Diffstat (limited to 'src/FbTk/FbTime.hh')
-rw-r--r-- | src/FbTk/FbTime.hh | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/FbTk/FbTime.hh b/src/FbTk/FbTime.hh new file mode 100644 index 0000000..2b33dd8 --- /dev/null +++ b/src/FbTk/FbTime.hh | |||
@@ -0,0 +1,58 @@ | |||
1 | // FbTime.hh for FbTk - Fluxbox Toolkit | ||
2 | // Copyright (c) 2012 Mathias Gumz (akira at fluxbox dot org) | ||
3 | // | ||
4 | // Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | // copy of this software and associated documentation files (the "Software"), | ||
6 | // to deal in the Software without restriction, including without limitation | ||
7 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | // and/or sell copies of the Software, and to permit persons to whom the | ||
9 | // Software is furnished to do so, subject to the following conditions: | ||
10 | // | ||
11 | // The above copyright notice and this permission notice shall be included in | ||
12 | // all copies or substantial portions of the Software. | ||
13 | // | ||
14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | // DEALINGS IN THE SOFTWARE. | ||
21 | |||
22 | #ifndef FBTK_FBTIME_HH | ||
23 | #define FBTK_FBTIME_HH | ||
24 | |||
25 | |||
26 | #ifdef HAVE_CONFIG_H | ||
27 | #include "config.h" | ||
28 | #endif // HAVE_CONFIG_H | ||
29 | |||
30 | |||
31 | #ifdef HAVE_INTTYPES_H | ||
32 | #include <inttypes.h> | ||
33 | #endif // HAVE_INTTYPES_H | ||
34 | |||
35 | namespace FbTk { | ||
36 | |||
37 | // time in micro-seconds, monotonic increasing | ||
38 | // | ||
39 | // interesting links: | ||
40 | // | ||
41 | // http://www.python.org/dev/peps/pep-0418/#operating-system-time-functions | ||
42 | // http://en.cppreference.com/w/cpp/chrono | ||
43 | |||
44 | namespace FbTime { | ||
45 | |||
46 | const uint64_t IN_MILLISECONDS = 1000L; | ||
47 | const uint64_t IN_SECONDS = 1000L * 1000L; | ||
48 | |||
49 | uint64_t now(); | ||
50 | |||
51 | // calculates the remaining microseconds up to the next full 'unit' | ||
52 | uint64_t remainingNext(uint64_t unit); | ||
53 | |||
54 | } // namespace FbTime | ||
55 | |||
56 | } // namespace FbTk | ||
57 | |||
58 | #endif // FBTK_TIME_HH | ||