https://wiki.amigaos.net/w/index.php?title=BattClock_Resource&feed=atom&action=history BattClock Resource - Revision history 2024-03-28T21:53:47Z Revision history for this page on the wiki MediaWiki 1.34.0 https://wiki.amigaos.net/w/index.php?title=BattClock_Resource&diff=9267&oldid=prev Daniel Jedlicka: Polished the page, added OS4-updated example code by Doug Stastny, and removed the WIP banner. 2017-12-06T12:03:47Z <p>Polished the page, added OS4-updated example code by Doug Stastny, and removed the WIP banner.</p> <a href="//wiki.amigaos.net/w/index.php?title=BattClock_Resource&amp;diff=9267&amp;oldid=3519">Show changes</a> Daniel Jedlicka https://wiki.amigaos.net/w/index.php?title=BattClock_Resource&diff=3519&oldid=prev Alexandre Balaban: Make use of Note template 2012-07-12T21:46:21Z <p>Make use of Note template</p> <table class="diff diff-contentalign-left" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 21:46, 12 July 2012</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 16:</td> <td colspan="2" class="diff-lineno">Line 16:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>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|Utility Library]] for a discussion of the utility.library and the SDK for a listing of its functions.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>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|Utility Library]] for a discussion of the utility.library and the SDK for a listing of its functions.</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{Note|title=''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.}}</div></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>{| class="wikitable"</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>| ''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.</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>|}</div></td> <td colspan="2" class="diff-empty">&#160;</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>&lt;pre&gt;</div></td> </tr> </table> Alexandre Balaban https://wiki.amigaos.net/w/index.php?title=BattClock_Resource&diff=1802&oldid=prev Steven Solie at 16:35, 2 May 2012 2012-05-02T16:35:19Z <p></p> <table class="diff diff-contentalign-left" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 16:35, 2 May 2012</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 1:</td> <td colspan="2" class="diff-lineno">Line 1:</td> </tr> <tr> <td colspan="2" class="diff-empty">&#160;</td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{WIP}}</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>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.</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>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.</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> </table> Steven Solie https://wiki.amigaos.net/w/index.php?title=BattClock_Resource&diff=1630&oldid=prev Steven Solie at 23:04, 1 May 2012 2012-05-01T23:04:03Z <p></p> <table class="diff diff-contentalign-left" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Older revision</td> <td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Revision as of 23:04, 1 May 2012</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 13:</td> <td colspan="2" class="diff-lineno">Line 13:</td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>|}</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>|}</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">−</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>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 <del class="diffchange diffchange-inline">“Utility</del> <del class="diffchange diffchange-inline">Library” chapter of the ''Amiga ROM Kernel Reference Manual: Libraries''</del> for a discussion of the utility.library and the <del class="diffchange diffchange-inline">''Amiga ROM Kernel Reference Manual: Includes and Autodocs''</del> for a listing of its functions.</div></td> <td class="diff-marker">+</td> <td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>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 <ins class="diffchange diffchange-inline">[[Utility_Library|Utility</ins> <ins class="diffchange diffchange-inline">Library]]</ins> for a discussion of the utility.library and the <ins class="diffchange diffchange-inline">SDK</ins> for a listing of its functions.</div></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td> </tr> <tr> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{| class="wikitable"</div></td> <td class="diff-marker">&#160;</td> <td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{| class="wikitable"</div></td> </tr> </table> Steven Solie https://wiki.amigaos.net/w/index.php?title=BattClock_Resource&diff=865&oldid=prev Steven Solie: Created page with "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 se..." 2012-04-16T21:26:11Z <p>Created page with &quot;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 se...&quot;</p> <p><b>New page</b></p><div>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.<br /> <br /> 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.<br /> <br /> '''BattClock Resource Functions'''<br /> <br /> {| class=&quot;wikitable&quot;<br /> | ReadBattClock() || Read the time from the BattClock and returns it as the number of seconds since 12:00 AM, January 1, 1978.<br /> |-<br /> | ResetBattClock() || Reset the BattClock to 12:00 AM, January 1, 1978.<br /> |-<br /> | WriteBattClock() || Set the BattClock to the number of seconds you pass it relative to 12:00 AM, January 1, 1978.<br /> |}<br /> <br /> 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.<br /> <br /> {| class=&quot;wikitable&quot;<br /> | ''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.<br /> |}<br /> <br /> &lt;pre&gt;<br /> /*<br /> * Read_BattClock.c<br /> *<br /> * Example of reading the BattClock and converting its output to<br /> * a useful measure of time by calling the Amiga2Date() utility function.<br /> *<br /> * Compile with SAS C 5.10 lc -b1 -cfistq -v -y -L<br /> *<br /> * Run from CLI only<br /> */<br /> <br /> #include &amp;lt;exec/types.h&amp;gt;<br /> #include &amp;lt;dos/dos.h&amp;gt;<br /> #include &amp;lt;utility/date.h&amp;gt;<br /> #include &amp;lt;resources/battclock.h&amp;gt;<br /> <br /> #include &amp;lt;clib/exec_protos.h&amp;gt;<br /> #include &amp;lt;clib/alib_protos.h&amp;gt;<br /> #include &amp;lt;clib/battclock_protos.h&amp;gt;<br /> #include &amp;lt;clib/utility_protos.h&amp;gt;<br /> <br /> #include &amp;lt;stdio.h&amp;gt;<br /> <br /> #ifdef LATTICE<br /> int CXBRK(void) { return(0); } /* Disable SAS CTRL/C handling */<br /> int chkabort(void) { return(0); } /* really */<br /> #endif<br /> <br /> VOID main(VOID);<br /> <br /> struct Library *UtilityBase = NULL;<br /> struct Library *BattClockBase;<br /> <br /> VOID main(VOID)<br /> {<br /> UBYTE *Days[] ={&amp;quot;Sunday&amp;quot;,&amp;quot;Monday&amp;quot;,&amp;quot;Tuesday&amp;quot;,&amp;quot;Wednesday&amp;quot;,&amp;quot;Thursday&amp;quot;,&amp;quot;Friday&amp;quot;,&amp;quot;Saturday&amp;quot;};<br /> UBYTE *Months[] = {&amp;quot;January&amp;quot;,&amp;quot;February&amp;quot;,&amp;quot;March&amp;quot;,&amp;quot;April&amp;quot;,&amp;quot;May&amp;quot;,&amp;quot;June&amp;quot;,<br /> &amp;quot;July&amp;quot;,&amp;quot;August&amp;quot;,&amp;quot;September&amp;quot;,&amp;quot;October&amp;quot;,&amp;quot;November&amp;quot;,&amp;quot;December&amp;quot;};<br /> UBYTE *ampm;<br /> ULONG AmigaTime;<br /> struct ClockData MyClock;<br /> <br /> if (UtilityBase = (struct Library *)OpenLibrary(&amp;quot;utility.library&amp;quot;,33))<br /> {<br /> if (BattClockBase= OpenResource(BATTCLOCKNAME))<br /> {<br /> /* Get number of seconds till now */<br /> AmigaTime = ReadBattClock();<br /> <br /> /* Convert to a ClockData structure */<br /> Amiga2Date(AmigaTime,&amp;amp;MyClock);<br /> <br /> printf(&amp;quot;\nRobin, tell everyone the BatDate and BatTime&amp;quot;);<br /> <br /> /* Print the Date */<br /> printf(&amp;quot;\n\nOkay Batman, the BatDate is &amp;quot;);<br /> printf(&amp;quot;%s, %s %d, %d&amp;quot;,Days[MyClock.wday],Months[MyClock.month-1],<br /> MyClock.mday,MyClock.year);<br /> <br /> /* Convert military time to normal time and set AM/PM */<br /> if (MyClock.hour &amp;lt; 12)<br /> ampm = &amp;quot;AM&amp;quot;; /* hour less than 12, must be morning */<br /> else<br /> {<br /> ampm = &amp;quot;PM&amp;quot;; /* hour greater than 12,must be night */<br /> MyClock.hour -= 12; /* subtract the extra 12 of military */<br /> };<br /> <br /> if (MyClock.hour == 0)<br /> MyClock.hour = 12; /* don't forget the 12s */<br /> <br /> /* Print the time */<br /> printf(&amp;quot;\n the BatTime is &amp;quot;);<br /> printf(&amp;quot;%d:%02d:%02d %s\n\n&amp;quot;,MyClock.hour,MyClock.min,MyClock.sec,ampm);<br /> }<br /> else<br /> printf(&amp;quot;Error: Unable to open the %s\n&amp;quot;,BATTCLOCKNAME);<br /> <br /> /* Close the utility library */<br /> CloseLibrary(UtilityBase);<br /> }<br /> <br /> else<br /> printf(&amp;quot;Error: Unable to open utility.library\n&amp;quot;);<br /> }<br /> &lt;/pre&gt;<br /> <br /> 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.</div> Steven Solie