2
將時間寫入RTC芯片/ dev/rtc上的ioctl RTC_SET_TIME可用於設置RTC芯片的時間和日期。但是/ dev/rtc只允許一個進程打開它。是否可以使用clock_settime()
所以我打算繼續使用clock_settime()這不需要打開/ dev/rtc設備。但我不清楚它是否將日期和時間設置到RTC 芯片。
根據手冊頁,clock_settime()
API支持以下時鐘。哪一個寫入RTC 芯片(如果支持)?
CLOCK_REALTIME
System-wide realtime clock. Setting this clock requires appropriate privileges.
CLOCK_MONOTONIC
Clock that cannot be set and represents monotonic time since some unspecified starting point.
CLOCK_PROCESS_CPUTIME_ID
High-resolution per-process timer from the CPU.
CLOCK_THREAD_CPUTIME_ID
Thread-specific CPU-time clock.
不,這個功能不是用來設置任何(硬件)*時鐘*。它旨在用於用戶空間程序測量*時間*。如果你想要一個時鐘(「掛鐘」)安裝NTP,它將處理系統中的實際時間。 – wildplasser 2013-04-07 10:53:17