BlueSync - BLE Time Sync for Zephyr
High-precision time synchronization for BLE Mesh networks
Loading...
Searching...
No Matches
local_time.h
Go to the documentation of this file.
1/*
2 * Copyright 2025 Tobias Moullet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * File: local_time.h
17 * Description: Private API for managing the local time
18 *
19 * Project: BlueSync - BLE Time Sync for Zephyr
20 * Repository: https://github.com/Tobi15/zephyr-bluesync-ble
21 */
22
23
24
25#ifndef ZEPHYR_BLUESYNC_SRC_LOCAL_TIME_H_
26#define ZEPHYR_BLUESYNC_SRC_LOCAL_TIME_H_
27#include <stdint.h>
28
38uint64_t get_logical_time_us(void);
39
48uint64_t get_logical_time_ticks(void);
49
57uint64_t convert_uptime_ticks_to_est_master_ticks(uint64_t uptime_ticks);
58
65
72
83
91void set_new_epoch_unix_ref(uint64_t epoch_ref_us);
92
103void apply_timer_sync(double slope_timer, double offset_timer_us);
104
115uint64_t uncompress_time(uint32_t compress_32bit_timestamp);
116
117#endif /* ZEPHYR_BLUESYNC_SRC_LOCAL_TIME_H_ */
void apply_timer_sync(double slope_timer, double offset_timer_us)
Apply the synchronisation parameters. Once the LR is made, The result of it gives a drift value (slop...
Definition local_time.c:101
uint64_t convert_uptime_ticks_to_est_master_ticks(uint64_t uptime_ticks)
Convert a ticks value into an estimation in ticks of the overall unix epoch timestamp.
void set_new_epoch_unix_ref(uint64_t epoch_ref_us)
Set the new epoch unix ref value. Before the authority node starts a new network synchronisation,...
Definition local_time.c:112
uint64_t uncompress_time(uint32_t compress_32bit_timestamp)
Convert a uint32_t timestamps into a uint64_t values. This should be used in the sink node....
Definition local_time.c:163
int64_t get_uptime_ticks_with_epoch()
Get the uptime ticks with epoch value. This method concerns only the authority Role....
Definition local_time.c:143
double get_current_offset_ticks()
Get the current offset ticks value.
Definition local_time.c:159
uint64_t get_logical_time_ticks(void)
Get the logical time ticks value. This is the corrected ticks value after synchronisation....
Definition local_time.c:97
uint64_t get_logical_time_us(void)
Get the logical time us value. This is the corrected us value after synchronisation....
Definition local_time.c:92
double get_current_slope_ticks()
Get the current slope ticks value.
Definition local_time.c:155