[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

The battery-backed clock (BattClock) keeps Amiga time while the system is
powered off.  The time from the BattClock is loaded into the Amiga system
clock as part of the boot sequence.

The battclock resource provides access to the BattClock.  Three functions
allow you to read the BattClock value, reset it and set it to a value you
desire.

                           BattClock Resource Functions
                           ----------------------------
     readbattclock()       read the time from the battclock and
                           returns it as the number of seconds since
                           12:00 AM, January 1, 1978.

     resetbattclock()      reset the battclock to 12:00 am, january 1,
                           1978.

     writebattclock()      set the battclock to the number of seconds
                           you pass it relative to 12:00 AM, January
                           1, 1978.

The utility.library contains time functions which convert the number of
seconds since 12:00 AM, January 1, 1978 to a date and time we can
understand, and vice versa.  You will find these functions useful when
dealing with the BattClock.  The example program below uses the
amiga2date() utility function to convert  the value returned by
readbattclock().  see the "utility library" chapter of the amiga rom
Kernel Reference Manual: Libraries for a discussion of the utility.library
and the Amiga ROM Kernel Reference Manual: includes and autodocs for a
listing of its functions.

   So, You Want to Be A Time Lord?
   -------------------------------
   This resource will allow you to set the BattClock to any value you
   desire. Keep in mind that this time will endure a reboot and could
   adversely affect your system.

     read_battclock.c 

Additional programming information on the battclock resource can be found
in the include files and the Autodocs for the battclock resource and the
utility library.