⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module rtc

Module rtc 

Source
Expand description

CMOS Real-Time Clock (RTC) reader for x86_64.

Reads date/time from the MC146818-compatible CMOS RTC via I/O ports 0x70 (index) and 0x71 (data). Converts BCD-encoded values to binary and provides a Unix-epoch-relative timestamp for the panel clock.

Structs§

RtcAlarm
Alarm time for ioctl RTC_ALM_SET.
RtcTime
RTC time snapshot.

Constants§

RTC_AIE_OFF
Ioctl command: disable alarm interrupt.
RTC_AIE_ON
Ioctl command: enable alarm interrupt.
RTC_ALM_SET
Ioctl command: set alarm time.

Functions§

current_epoch_secs
Get current wall-clock seconds since Unix epoch.
disable_alarm
Disable the CMOS alarm interrupt.
get_time_correction
Get the current NTP correction in milliseconds.
get_timezone_offset
Get the current timezone offset in seconds.
init
Read the CMOS RTC and initialize the boot epoch.
read_rtc
Read the RTC registers, handling BCD conversion and update-in-progress.
rtc_interrupt_handler
RTC interrupt handler (IRQ 8, vector 40 on PIC / remapped on APIC).
rtc_ioctl
Perform an RTC ioctl operation.
rtc_read
Read the current RTC time (/dev/rtc read interface).
set_alarm
Set the CMOS alarm to fire at the given hour:minute:second.
set_alarm_callback
Register a callback function pointer to invoke when the alarm fires.
set_time_correction
Apply a time correction from an NTP client.
set_timezone_offset
Set the timezone offset from UTC in seconds.