summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/include/sys
diff options
context:
space:
mode:
authorGuEe-GUI <[email protected]>2026-06-14 11:37:08 +0800
committerRbb666 <[email protected]>2026-06-29 16:55:18 +0800
commit11ca1660069bbeaba478a8c8be5dbf2a3c3fb60c (patch)
tree29cc9051a874121b056d77e5dc7b9d31742c29a6 /components/libc/compilers/common/include/sys
parent1f9146897be1d898bea2a3ed0492c2d0a0507320 (diff)
[dm][ptp] support Precision Time Protocol (PTP) IEEE 1588 clock
Signed-off-by: GuEe-GUI <[email protected]>
Diffstat (limited to 'components/libc/compilers/common/include/sys')
-rw-r--r--components/libc/compilers/common/include/sys/time.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/libc/compilers/common/include/sys/time.h b/components/libc/compilers/common/include/sys/time.h
index 817fe78676..8804433eeb 100644
--- a/components/libc/compilers/common/include/sys/time.h
+++ b/components/libc/compilers/common/include/sys/time.h
@@ -198,6 +198,14 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#define CLOCK_TAI 11 // newlib says they don't have this definition, make the compiler happy
#endif /* CLOCK_TAI */
+#ifdef RT_USING_PTP
+#ifndef CLOCKFD
+#define CLOCKFD 3
+#endif /* CLOCKFD */
+#define FD_TO_CLOCKID(fd) ((clockid_t)((~(clockid_t)(fd) << 3) | CLOCKFD))
+#define CLOCKID_TO_FD(clk) ((unsigned int)(~((unsigned int)(clk) >> 3)))
+#endif /* RT_USING_PTP */
+
#endif /* defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER) */
#ifdef RT_USING_POSIX_CLOCK