The rtc translator implements a real-time clock driver. It can be used to add
the rtc
device files, with those files, we can access the underlying
real-time clock using ioctl()
. The description of ioctl()
can be found
here.
The operation macros are required to access the real-time clock. They are
defined as RTC_*
in hurd/rtc.h
.
The hwclock
command from util-linux
can use the rtc
device files to
access the real-time clock devices.
Usage Example
Setup a rtc
device file in /tmp
:
settrans -c /tmp/rtc /hurd/rtc
Read the time value through the rtc
device file:
int fd = open("/tmp/rtc", O_RDONLY);
struct rtc_time time;
ioctl(fd, RTC_RD_TIME, &time);