question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve derived_tstamp/implement better approximation of actual time of event

See original GitHub issue

Currently, the derived timestamp logic is as follows:

derived_tstamp = collector_tstamp - (dvce_sent_tstamp - dvce_created_tstamp)

As I understand it, the logic is that the collector timestamp is the first time we confidently establish a measurement of actual time, so we take that as the basis, and subtract lag between creating and sending the event.

This leads to unusual values in the case of events which are sent late due to connectivity issues.

A suggested improvement on this logic is as follows:

  • Assume a reasonable time between collector_tstamp and dvce_sent_tstamp (I think this would be within a second or a few seconds)
  • Calculate difference between collector_tstamp and dvce_sent_tstamp, if it’s above that number - this gives you how far off the actual time of day the devices clock is.
  • Offset the dvce_created_tstamp by that delta to produce a more consistently accurate measurement of actual time of event.

I believe this is better because:

  • no matter what, the dvce_created_tstamp always gives you when the events happened in relation to each other.
  • Collector and dvce_sent timestamps should be very very close to each other. The difference between these values is therefore presumed to be an accurate measure of the device clock’s offset from actual time UTC
  • Therefore the dvce_created_tstamp adjusted by this offset returns a good approximation of the actual time of event.

There’s still scope for inaccuracies in the rare case that the device clock changes between events, but avoids strange values resulting from lag between sending consecutive events.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
alexanderdeancommented, Nov 2, 2018

Right, yes - the calculation is sensitive to a change in clock between creation and sending.

We could probably mostly fix this by tracking device TZ before sending and then adjusting as needed (i.e. manual correction to dvce_tstamp in tracker). Only mostly fix because we can’t detect other changes like a manual clock adjustment. But they must be extremely rare on mobile.

0reactions
chuwycommented, Jun 19, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

improve derived_tstamp/implement better approximation of ...
As I understand it, the logic is that the collector timestamp is the first time we confidently establish a measurement of actual time,...
Read more >
Acquiring high-resolution time stamps - Win32 apps
QPC is typically the best method to use to time-stamp events and measure small time intervals that occur on the same system or...
Read more >
Forensic Analysis of Digital Time | | Knowledge - Exponent
This database contains timestamps and cached longitude/latitude values that are typically used to help improve mapping/GPS performance. This ...
Read more >
Accuracy Evaluation of Emergency Department Tracking ...
This study was a prospective observational study designed to capture the actual time events in the ED occurred, and compare that time to...
Read more >
TEASER: early and accurate time series classification
The state-of-the-art eTSC methods compute a fixed optimal decision time assuming that every times series has the same defined start time (like ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found