| 1 | /* |
| 2 | * The MIT License (MIT) |
| 3 | * |
| 4 | * Copyright (c) 2016 Philippe Proulx <pproulx@efficios.com> |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to deal |
| 8 | * in the Software without restriction, including without limitation the rights |
| 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | * copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in |
| 14 | * all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | * THE SOFTWARE. |
| 23 | */ |
| 24 | |
| 25 | /* From clock-class-const.h */ |
| 26 | |
| 27 | typedef enum bt_clock_class_status { |
| 28 | BT_CLOCK_CLASS_STATUS_OK = 0, |
| 29 | BT_CLOCK_CLASS_STATUS_NOMEM = -12, |
| 30 | BT_CLOCK_CLASS_STATUS_OVERFLOW = -75, |
| 31 | } bt_clock_class_status; |
| 32 | |
| 33 | extern const char *bt_clock_class_get_name( |
| 34 | const bt_clock_class *clock_class); |
| 35 | |
| 36 | extern const char *bt_clock_class_get_description( |
| 37 | const bt_clock_class *clock_class); |
| 38 | |
| 39 | extern uint64_t bt_clock_class_get_frequency( |
| 40 | const bt_clock_class *clock_class); |
| 41 | |
| 42 | extern uint64_t bt_clock_class_get_precision( |
| 43 | const bt_clock_class *clock_class); |
| 44 | |
| 45 | extern void bt_clock_class_get_offset(const bt_clock_class *clock_class, |
| 46 | int64_t *OUT, uint64_t *OUT); |
| 47 | |
| 48 | extern bt_bool bt_clock_class_origin_is_unix_epoch( |
| 49 | const bt_clock_class *clock_class); |
| 50 | |
| 51 | extern bt_uuid bt_clock_class_get_uuid( |
| 52 | const bt_clock_class *clock_class); |
| 53 | |
| 54 | extern bt_clock_class_status bt_clock_class_cycles_to_ns_from_origin( |
| 55 | const bt_clock_class *clock_class, |
| 56 | uint64_t cycles, int64_t *OUT); |
| 57 | |
| 58 | extern void bt_clock_class_get_ref(const bt_clock_class *clock_class); |
| 59 | |
| 60 | extern void bt_clock_class_put_ref(const bt_clock_class *clock_class); |
| 61 | |
| 62 | /* From clock-class.h */ |
| 63 | |
| 64 | extern bt_clock_class *bt_clock_class_create(bt_self_component *self_comp); |
| 65 | |
| 66 | extern bt_clock_class_status bt_clock_class_set_name( |
| 67 | bt_clock_class *clock_class, const char *name); |
| 68 | |
| 69 | extern bt_clock_class_status bt_clock_class_set_description( |
| 70 | bt_clock_class *clock_class, const char *description); |
| 71 | |
| 72 | extern void bt_clock_class_set_frequency(bt_clock_class *clock_class, |
| 73 | uint64_t freq); |
| 74 | |
| 75 | extern void bt_clock_class_set_precision(bt_clock_class *clock_class, |
| 76 | uint64_t precision); |
| 77 | |
| 78 | extern void bt_clock_class_set_offset(bt_clock_class *clock_class, |
| 79 | int64_t seconds, uint64_t cycles); |
| 80 | |
| 81 | extern void bt_clock_class_set_origin_is_unix_epoch(bt_clock_class *clock_class, |
| 82 | bt_bool origin_is_unix_epoch); |
| 83 | |
| 84 | extern void bt_clock_class_set_uuid(bt_clock_class *clock_class, |
| 85 | bt_uuid uuid); |