Skip to content

feat: honor check-in UTC time#1126

Draft
bassosimone wants to merge 10 commits intomasterfrom
issue/1781
Draft

feat: honor check-in UTC time#1126
bassosimone wants to merge 10 commits intomasterfrom
issue/1781

Conversation

@bassosimone
Copy link
Copy Markdown
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 requested a review from hellais as a code owner March 21, 2023 10:41
@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