OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains Mojo system time-related declarations/definitions. | 5 // This file contains Mojo system time-related declarations/definitions. |
6 // | 6 // |
7 // Note: This header should be compilable as C. | 7 // Note: This header should be compilable as C. |
8 | 8 |
9 #ifndef MOJO_PUBLIC_C_SYSTEM_TIME_H_ | 9 #ifndef MOJO_PUBLIC_C_SYSTEM_TIME_H_ |
10 #define MOJO_PUBLIC_C_SYSTEM_TIME_H_ | 10 #define MOJO_PUBLIC_C_SYSTEM_TIME_H_ |
11 | 11 |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
| 14 #include "mojo/public/c/system/macros.h" |
| 15 |
14 // |MojoTimeTicks|: A time delta, in microseconds, the meaning of which is | 16 // |MojoTimeTicks|: A time delta, in microseconds, the meaning of which is |
15 // source-dependent. | 17 // source-dependent. |
16 | 18 |
17 typedef int64_t MojoTimeTicks; | 19 typedef int64_t MojoTimeTicks; |
18 | 20 |
19 // |MojoDeadline|: Used to specify deadlines (timeouts), in microseconds (except | 21 // |MojoDeadline|: Used to specify deadlines (timeouts), in microseconds (except |
20 // for |MOJO_DEADLINE_INDEFINITE|). | 22 // for |MOJO_DEADLINE_INDEFINITE|). |
21 // |MOJO_DEADLINE_INDEFINITE| - Used to indicate "forever". | 23 // |MOJO_DEADLINE_INDEFINITE| - Used to indicate "forever". |
22 | 24 |
23 typedef uint64_t MojoDeadline; | 25 typedef uint64_t MojoDeadline; |
24 | 26 |
25 #define MOJO_DEADLINE_INDEFINITE ((MojoDeadline)-1) | 27 #define MOJO_DEADLINE_INDEFINITE ((MojoDeadline)-1) |
26 | 28 |
27 #ifdef __cplusplus | 29 MOJO_BEGIN_EXTERN_C |
28 extern "C" { | |
29 #endif | |
30 | 30 |
31 // Note: Pointer parameters that are labelled "optional" may be null (at least | 31 // Note: Pointer parameters that are labelled "optional" may be null (at least |
32 // under some circumstances). Non-const pointer parameters are also labeled | 32 // under some circumstances). Non-const pointer parameters are also labeled |
33 // "in", "out", or "in/out", to indicate how they are used. (Note that how/if | 33 // "in", "out", or "in/out", to indicate how they are used. (Note that how/if |
34 // such a parameter is used may depend on other parameters or the requested | 34 // such a parameter is used may depend on other parameters or the requested |
35 // operation's success/failure. E.g., a separate |flags| parameter may control | 35 // operation's success/failure. E.g., a separate |flags| parameter may control |
36 // whether a given "in/out" parameter is used for input, output, or both.) | 36 // whether a given "in/out" parameter is used for input, output, or both.) |
37 | 37 |
38 // Returns the time, in microseconds, since some undefined point in the past. | 38 // Returns the time, in microseconds, since some undefined point in the past. |
39 // The values are only meaningful relative to other values that were obtained | 39 // The values are only meaningful relative to other values that were obtained |
40 // from the same device without an intervening system restart. Such values are | 40 // from the same device without an intervening system restart. Such values are |
41 // guaranteed to be monotonically non-decreasing with the passage of real time. | 41 // guaranteed to be monotonically non-decreasing with the passage of real time. |
42 // Although the units are microseconds, the resolution of the clock may vary and | 42 // Although the units are microseconds, the resolution of the clock may vary and |
43 // is typically in the range of ~1-15 ms. | 43 // is typically in the range of ~1-15 ms. |
44 MojoTimeTicks MojoGetTimeTicksNow(void); | 44 MojoTimeTicks MojoGetTimeTicksNow(void); |
45 | 45 |
46 #ifdef __cplusplus | 46 MOJO_END_EXTERN_C |
47 } // extern "C" | |
48 #endif | |
49 | 47 |
50 #endif // MOJO_PUBLIC_C_SYSTEM_TIME_H_ | 48 #endif // MOJO_PUBLIC_C_SYSTEM_TIME_H_ |
OLD | NEW |