All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Lars-Peter Clausen <lars@metafoo.de>,
	Jonathan Cameron <jic23@kernel.org>,
	Gregor Boirie <gregor.boirie@parrot.com>,
	linux-iio@vger.kernel.org
Subject: Re: using monotonic clok for timstamping
Date: Mon, 08 Feb 2016 17:15:37 +0000	[thread overview]
Message-ID: <EDC91D66-140E-4BC1-BA2C-06689BB8FC02@jic23.retrosnub.co.uk> (raw)
In-Reply-To: <56B865FC.7020106@metafoo.de>



On 8 February 2016 09:55:08 GMT+00:00, Lars-Peter Clausen <lars@metafoo.de> wrote:
>On 02/06/2016 07:33 PM, Jonathan Cameron wrote:
>> On 03/02/16 11:22, Lars-Peter Clausen wrote:
>>> On 02/03/2016 11:55 AM, Gregor Boirie wrote:
>>>> Dear  all,
>>>>
>>>> Our application relies on precise and monotonic timestamping of IMU
>samples
>>>> (and other sensors).
>>>> I am wondering what reasons / use cases led to the choice of
>realtime clock
>>>> to implement
>>>> iio_get_time_ns (not to mention time gaps that may be seen after
>wake up
>>>> from sleep states).
>>>
>>> It's more of an oversight than a deliberate design decision. I
>noticed this
>>> problem as well a while ago and wanted to re-write things to use the
>>> monotonic clock, but then realized that this would be a ABI change
>so
>>> dropped it and forgot about it again.
>> There are certainly cases where the other clock would make sense (for
>slow
>> sampling device where being as correct as possible is the most
>important
>> thing).
>
>I'm not sure I understand what you are trying to say, maybe we are not
>on
>the same page. As far as I know both clocks have the same precession,
>but
>their absolute value differs.
>
>What iio_get_time_ns() currently returns is the system clock, which
>changes
>whenever the time is changed (e.g. to compensate for drift, or daylight
>saving, etc.). This is obviously not so great if that happens in the
>middle
>of the capture since what you care about is the relative distance
>between
>the samples and if your time base changes you have no idea what that is
>anymore.
>
>So the monotonic clock which just keeps going at a fixed interval would
>be
>the better choice.

In general I agree. My thought was that there are plausible usecases where a
 capture is every n minutes over days or years where a timestamp that tracks with
 'corrections' would make sense as intervals are not always the most
 important thing.

Most cases if course the monotonic clock is the best one. I chose badly a long time ago! Risk is someone is relying on it for some reason.

J

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

  reply	other threads:[~2016-02-08 17:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 10:55 Gregor Boirie
2016-02-03 11:22 ` Lars-Peter Clausen
2016-02-06 18:33   ` Jonathan Cameron
2016-02-08  9:55     ` Lars-Peter Clausen
2016-02-08 17:15       ` Jonathan Cameron [this message]
2016-02-09 11:06         ` Gregor Boirie
2016-02-09 14:19           ` Gregor Boirie
2016-02-09 20:49             ` Jonathan Cameron
2016-02-09 20:52           ` Lars-Peter Clausen
2016-02-09 21:02             ` Jonathan Cameron
2016-02-10  9:46             ` Gregor Boirie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EDC91D66-140E-4BC1-BA2C-06689BB8FC02@jic23.retrosnub.co.uk \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=gregor.boirie@parrot.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --subject='Re: using monotonic clok for timstamping' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.