[alsa-devel] Monotonic timestamps

Pieter Palmers pieterp at joow.be
Thu Apr 10 19:20:08 CEST 2008

Lennart Poettering wrote:
> On Thu, 10.04.08 09:03, Pieter Palmers (pieterp at joow.be) wrote:
>>> I find it very strange that ALSA just switches to monotonic timestamps
>>> just like that, anyway. Programs written for wallclack timestamps will
>>> break if they run on a system where ALSA uses monotonic timestamps!
>>> There's a function missing that enables monotonic timestamps
>>> explicitly, or at least one that can be used to query if they are
>>> monotonic or not.
>> The clean solution would (IMHO) be to have ALSA provide a function to 
>> obtain 'current time', thereby making the timestamp system 
>> self-contained. Maybe it already does...
> This wouldn't help much since timestamps might also come from other
> libraries. i.e. being able to relate timestamps from ALSA with
> timestamps from the application itself is not enough. They also need
> to be relatable to timestamps from other code, which might not
> necessarily be linked against ALSA.
> i.e. think of gstreamer that uses timestamps attached to each video
> frame. Do you really expect gst to move their timestamp source over to
> ALSA just because one of the plugins for gst supports ALSA?

Let me put it another way: if some library provides timestamps, it 
should also provide a mechanism to obtain the current time. That way the 
  application is able to relate the timestamps to whatever clock it wants.

On the other hand, the "mechanism to obtain the current time" could 
equally well be "use CLOCK_MONOTONIC". In that sense your original post 
points out the issue, since obviously ALSA doesn't provide this info.

Never mind the noise.


More information about the Alsa-devel mailing list