[OpenBIOS] [PATCH] Adds the get-time word to the dictionary. It returns the current time and date on the stack.

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Sep 25 00:40:27 CEST 2012


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 at 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?


ATB,

Mark.




More information about the OpenBIOS mailing list