Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Precision Time Protocol time specification. More...

Data Structures

struct  net_ptp_time
 (Generalized) Precision Time Protocol Timestamp format. More...
 
struct  net_ptp_extended_time
 Generalized Precision Time Protocol Extended Timestamp format. More...
 

Functions

static net_time_t net_ptp_time_to_ns (struct net_ptp_time *ts)
 Convert a PTP timestamp to a nanosecond precision timestamp, both related to the local network reference clock.
 
static struct net_ptp_time ns_to_net_ptp_time (net_time_t nsec)
 Convert a nanosecond precision timestamp to a PTP timestamp, both related to the local network reference clock.
 

Detailed Description

Precision Time Protocol time specification.

Function Documentation

◆ net_ptp_time_to_ns()

static net_time_t net_ptp_time_to_ns ( struct net_ptp_time ts)
inlinestatic

#include <zephyr/net/ptp_time.h>

Convert a PTP timestamp to a nanosecond precision timestamp, both related to the local network reference clock.

Note
Only timestamps representing up to ~290 years can be converted to nanosecond timestamps. Larger timestamps will return the maximum representable nanosecond precision timestamp.
Parameters
tsthe PTP timestamp
Returns
the corresponding nanosecond precision timestamp

◆ ns_to_net_ptp_time()

static struct net_ptp_time ns_to_net_ptp_time ( net_time_t  nsec)
inlinestatic

#include <zephyr/net/ptp_time.h>

Convert a nanosecond precision timestamp to a PTP timestamp, both related to the local network reference clock.

Parameters
nseca nanosecond precision timestamp
Returns
the corresponding PTP timestamp