Skip to content

iio_push_to_buffers_with_timestamp()

Purpose

Pushes one scan frame into the IIO buffer and appends a timestamp.

#include <linux/iio/buffer.h>

Prototype

int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
                                       const void *data,
                                       int64_t timestamp);

Parameters

  • indio_dev: IIO device that owns the buffer.
  • data: pointer to one scan frame without the timestamp field.
  • timestamp: timestamp in nanoseconds.

Return Value

  • 0 on success.
  • Negative errno on failure.

Minimal Example

int64_t ts = iio_get_time_ns(indio_dev);

return iio_push_to_buffers_with_timestamp(indio_dev, &scan, ts);

Common Pitfalls

  • The timestamp is appended according to the buffer scan layout.
  • The pushed data must not already include the timestamp unless the driver intentionally manages a matching layout.
  • For FIFO data, the push timestamp may not represent the original sample time.