#define STORAGE_ID "/nqptp"
#define MAX_CLOCKS 32
-#define NQPTP_SHM_STRUCTURES_VERSION 4
+#define NQPTP_SHM_STRUCTURES_VERSION 5
#define NQPTP_CONTROL_PORT 9000
// the control port will accept a UDP packet with the first letter being:
char master_clock_ip[64]; // where it's coming from
uint64_t local_time; // the time when the offset was calculated
uint64_t local_to_master_time_offset; // add this to the local time to get master clock time
+ uint64_t master_clock_start_time; // this is when the master clock became master
};
#endif
int rc = pthread_mutex_lock(&shared_memory->shm_mutex);
if (rc != 0)
warn("Can't acquire mutex to update master clock!");
- shared_memory->master_clock_id = master_clock_id;
+ if (shared_memory->master_clock_id != master_clock_id) {
+ shared_memory->master_clock_id = master_clock_id;
+ shared_memory->master_clock_start_time = get_time_now();
+ }
if (ip != NULL)
strncpy((char *)&shared_memory->master_clock_ip, ip,
FIELD_SIZEOF(struct shm_structure, master_clock_ip) - 1);
if (argv[i][0] == '-') {
if (strcmp(argv[i] + 1, "V") == 0) {
#ifdef CONFIG_USE_GIT_VERSION_STRING
- if (git_version_string[0] != '\0')
+ if (git_version_string[0] != '\0')
fprintf(stdout, "Version: %s. Shared Memory Interface Version: %u.\n", git_version_string,
NQPTP_SHM_STRUCTURES_VERSION);
else