Skip to content

Commit

Permalink
Merge pull request #18 from Technica-Engineering/fix-tstamp-resolutio…
Browse files Browse the repository at this point in the history
…n-ticket-17

Bugfix: fixing timestamps with 10us
  • Loading branch information
kayoub5 authored Jul 21, 2023
2 parents b4f064c + 04799e6 commit c4177f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ std::uint64_t calculate_ts_res(ObjectHeaderGeneric* oh)
switch (oh->objectFlags) {
case ObjectHeader::ObjectFlags::TimeTenMics:
ts_resol = 100000;
break;
case ObjectHeader::ObjectFlags::TimeOneNans:
ts_resol = NANOS_PER_SEC;
break;
Expand Down Expand Up @@ -170,7 +171,8 @@ int write_packet(
uint64_t ts_resol = calculate_ts_res(oh);
if (ts_resol == 0) return -3;

interface.timestamp_resolution = ts_resol;
/* since we convert to NS, we need to always set the output to NS */
interface.timestamp_resolution = NANOS_PER_SEC;

light_packet_header header = { 0 };
uint64_t ts = (NANOS_PER_SEC / ts_resol) * oh->objectTimeStamp + date_offset_ns;
Expand Down

0 comments on commit c4177f2

Please sign in to comment.