Skip to content

[FR] Support for CLOCK_MONOTONIC_RAW for packet timestamps #1570

@fivlao

Description

@fivlao

Would it be possible to add support for using CLOCK_MONOTONIC_RAW — or optionally all of the monotonic clock types (CLOCK_MONOTONIC, CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_RAW) — so that the timestamp stored in pcap_pkthdr->ts represents the time elapsed since the system boot time, rather than the wall-clock time?

This would be useful in cases where:

  • Wall-clock time can jump backwards or forwards (NTP adjustments, manual time changes),
  • Monotonic timestamps are required for precise packet timing or latency measurements,
  • Raw hardware time is preferred, without NTP corrections (CLOCK_MONOTONIC_RAW).

Goal:
Have packet timestamps (pcap_pkthdr->ts) generated using a monotonic clock source instead of the system clock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions