Subject: [core] Relative times in responses, Age and Max-Age

From: Christian Amsüss <[email-masked]>
Date: Mon, 9 Aug 2021 17:05:10 +0200

Hi,

discussing an upcoming draft Martine is composing on DNS-over-CoAP,
questions on relative times in CoAP responses came up.

Root of the issue is that on the application level, different parts of a
response can have different life times. At the same time, we want to use
CoAP proxy caches (ie. as long as *all* parts of the response are still
valid). Consequently, the client does not have the time of its request
as a reliable reference point for the times indicated in the response.
(Keeping in mind that we don't want to rely on some consensus time frame
-- there's no indication devices will know UNIX time).

We're currently floating two (largely equivalent) ideas:

* Transport all times relative to the first request. Set the Max-Age
  option to the smallest of the times involved. If the client sees a
  Max-Age less than the smallest payload time, it will subtract the
  difference from all times.

* Transport all times relative to the end of Max-Age. The client can add
  Max-Age to all times.

HTTP is using an Age header to be subtracted from all values, but a) I'd
rather not introduce a new option that all proxies would need to
support, and b) using Max-Age gives a compatible unilateral estimation
of the true value (a proxy reducing Max-Age doesn't hurt), whereas the
lack of an Age value could just as well mean that it was produced by a
proxy that doesn't know Age.

Is there any experience implementing things like this in CoRE? Best I
found was SenML's 'roughly "now"', which doesn't talk about
representation lifetimes.

Thanks
Christian

-- 
Yesterday is history, tomorrow is a mystery, and today is a gift. That
is why it is called the present.
  -- ancient saying