# Real-Time Clock

BeebEm emulates three different real-time clock modules: the 146818 in the BBC Master Series, the Acorn Econet Level 3 File Server Real Time Clock Module, which uses an SAF3019P, and the CDP6818E in the Computech Integra-β.

## BBC Master Series

The RTC can be used in Master 128 and Master ET modes. The BASIC TIME$ variable can be used to read and update the clock. When BeebEm starts it sets the clock to the current time from the PC's clock.

Note that the Master MOS does not display dates from the year 2000 onwards correctly. Only the last two digits of the year are stored. The MOS still displays years as 19xx, but will accept any century when setting the time using TIME$.

Some examples of reading and setting the clock:

              PRINT TIME$
              TIME$="Mon,22 Jan 1996"
              TIME$="23:10:42"
              TIME$="Mon,22 Jan 1996.23:10:42"

## User Port Real-Time Clock

The Hardware → User Port RTC Module menu option enables or disables the Acorn Econet Level 3 File Server Real Time Clock Module, which connects to the BBC Micro's User Port (pictured below). You should enable this option when running the Level 3 File Server software.

This module uses the SAF3019P clock/timer. The SAF3019P only counts minutes, hours, days, and months, and not the year, so the year is typically stored in the registers usually dedicated to the alarm function on this RTC device. Use software in the emulated Beeb to set the current year. The state of the RTC registers is stored in Preferences.cfg, and you can either save the state manually using Options → Save Preferences, or automatically by enabling Options → Preference Options → Autosave CMOS RAM.

## Computech Integra-β Real-Time Clock

BeebEm emulates the Computech Integra-β expansion board's CDP6818E real-time clock, and the date and time report the time from the host PC's clock.

You can use the *DATE and *TIME commands to display the current date and time, but using *DATE = or *TIME = to change the clock is not supported.

              *DATE
              Sun,12 May 2024.
              *TIME
              Sun,12 May 2024.12:32:33