Add some information about the length of time a new clock master has been monitored for ("history") and warn if the PTP information hasn't been updated for more than a second (not extensively tested).
This commit is contained in:
+7
-2
@@ -65,7 +65,7 @@ int get_nqptp_data(struct shm_structure *nqptp_data) {
|
||||
return response;
|
||||
}
|
||||
|
||||
int ptp_get_clock_info(uint64_t *actual_clock_id, uint64_t *raw_offset,
|
||||
int ptp_get_clock_info(uint64_t *actual_clock_id, uint64_t *time_of_sample, uint64_t *raw_offset,
|
||||
uint64_t *mastership_start_time) {
|
||||
int response = clock_ok;
|
||||
pthread_cleanup_debug_mutex_lock(&ptp_access_mutex, 20000, 1);
|
||||
@@ -73,7 +73,10 @@ int ptp_get_clock_info(uint64_t *actual_clock_id, uint64_t *raw_offset,
|
||||
*actual_clock_id = 0;
|
||||
if (raw_offset != NULL)
|
||||
*raw_offset = 0;
|
||||
|
||||
if (time_of_sample != NULL)
|
||||
*time_of_sample = 0;
|
||||
if (mastership_start_time != NULL)
|
||||
*mastership_start_time = 0;
|
||||
if (ptp_shm_interface_open() == 0) {
|
||||
struct shm_structure nqptp_data;
|
||||
if (get_nqptp_data(&nqptp_data) == 0) {
|
||||
@@ -82,6 +85,8 @@ int ptp_get_clock_info(uint64_t *actual_clock_id, uint64_t *raw_offset,
|
||||
if (nqptp_data.master_clock_id != 0) {
|
||||
if (actual_clock_id != NULL)
|
||||
*actual_clock_id = nqptp_data.master_clock_id;
|
||||
if (time_of_sample != NULL)
|
||||
*time_of_sample = nqptp_data.local_time;
|
||||
if (raw_offset != NULL)
|
||||
*raw_offset = nqptp_data.local_to_master_time_offset;
|
||||
if (mastership_start_time != NULL)
|
||||
|
||||
Reference in New Issue
Block a user