Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This diff honors the check-in API time. We create a new package that stores the check-in API time. Because time.Time structs read from JSON do not contain a monotonic clock reading, we store a time.Time containing a monotonic clock reading as well. These two times will always have a bit of offset between them, but such as offset is smaller than the offset between the check-in API time and the probe clock when the probe clock is severely misconfigured.
We keep these times in memory. If a probe has not observed a check-in API response or the check-in API contained an empty time, we do not consider the check-in clock to be valid and so the package is basically disabled.
Otherwise, we have an API based time reference. We use this reference to:
include into measurements the check-in-API based clock reading of when we created a measurement, which allows the OONI backend to determine how safe it is to keep or discard the measurement;
warn the user if the offset is +- a few minutes.
See ooni/probe#1781