On Oct 4, 2012, at 3:30 PM, openbios-request@openbios.org wrote:


Message: 4
Date: Mon, 24 Sep 2012 23:40:27 +0100
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: The OpenBIOS Mailinglist <openbios@openbios.org>
Subject: Re: [OpenBIOS] [PATCH] Adds the get-time word to the
dictionary. It returns the current time and date on the stack.
Message-ID: <5060E15B.3020103@ilande.co.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 23/09/12 22:57, Programmingkid wrote:

Made a few changes to the patch. Thank you Tarl for your suggestions.

Signed-Off-By: John Arbuckle<programmingkidx@gmail.com>

---
 forth/system/main.fs |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/forth/system/main.fs b/forth/system/main.fs
index 122ab1f..16d4829 100644
--- a/forth/system/main.fs
+++ b/forth/system/main.fs
@@ -58,3 +58,25 @@ variable DIAG-list

   outer-interpreter
 ;
+
+\ Returns the time ( -- second minute hour day month year )
+: get-time
+   " rtc" open-dev   ( device )
+   dup             ( device device )
+
+   0=  if   \ if the real-time clock isn't available
+      drop           ( )
+      true           ( flag )
+      cr
+      abort" Sorry but get-time isn't available for your system. "
+   then
+
+   " get-time"       ( device addr len )
+   rot               ( addr len device )
+   dup               ( addr len device device )
+>r                ( addr len device )   ( R: device )
+   $call-method      ( addr len device -- second minute hour day month year )   ( R: device )
+   r>                 ( device )   ( R: )
+   close-dev         ( device -- )
+;
+

While I'm not objecting to this patch in principle, I find it quite 
unusual that Apple would place a word with the same arguments in the 
global namespace. In particular, I see references like this which 
suggest it is not required: 
http://hints.macworld.com/article.php?story=20060814075952448.

Can you give some more context as to why the get-time word in the rtc 
node cannot be used?

I was trying out some source code I found in the book "Mac OS X Internals"  on page 320. When I typed get-time, the word was not found in the dictionary. So I thought I could make a contribution by adding this word to the dictionary. A little later I found out the word was a part of the rtc node. I figure adding this word to the dictionary might help the next person who might be reading this book and trying out some of the source code in it.