File tree Expand file tree Collapse file tree 2 files changed +2
-0
lines changed Expand file tree Collapse file tree 2 files changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ uint64_t raopcl_get_ntp(struct ntp_s* ntp)
216216{
217217 uint64_t time = gettime_us ();
218218 uint32_t seconds = time / (1000 * 1000 );
219+ seconds += NTP_EPOCH_DELTA ; // Convert to NTP epoch (1900-01-01)
219220 uint32_t fraction = ((time % (1000 * 1000 )) << 32 ) / (1000 * 1000 );
220221
221222 if (ntp ) {
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ typedef struct ntp_s {
7272 uint32_t fraction ;
7373} ntp_t ;
7474
75+ #define NTP_EPOCH_DELTA 0x83aa7e80 /* 2208988800 - that's 1970 - 1900 in seconds */
7576#define NTP2MS (ntp ) ((((ntp) >> 10) * 1000L) >> 22)
7677#define MS2NTP (ms ) (((((uint64_t) (ms)) << 22) / 1000) << 10)
7778#define TIME_MS2NTP (time ) raopcl_time32_to_ntp(time)
You can’t perform that action at this time.
0 commit comments