Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: honor check-in UTC time #1126

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

feat: honor check-in UTC time #1126

wants to merge 10 commits into from

Conversation

bassosimone
Copy link
Contributor

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:

  1. 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;

  2. warn the user if the offset is +- a few minutes.

See ooni/probe#1781

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:

1. 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;

2. warn the user if the offset is +- a few minutes.

See ooni/probe#1781
@bassosimone bassosimone marked this pull request as draft March 21, 2023 10:44
@bassosimone bassosimone changed the title fix: honor check-in UTC time feat: honor check-in UTC time Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant