April 2020
Intermediate to advanced
412 pages
9h 58m
English
We will create an application that reads the current time from the Real-Time Clock (RTC) connected to the Raspberry Pi board:
#include <iostream>#include <system_error>#include <time.h>#include <unistd.h>#include <fcntl.h>#include <sys/ioctl.h>#include <linux/rtc.h>
class Rtc { int fd; public: Rtc() { fd = open("/dev/rtc", O_RDWR); if (fd < 0) { throw std::system_error(errno, std::system_category(), "Failed to open RTC ...