: get-time " rtc" open-dev ( ihandle ) ?dup 0= if cr abort" Sorry but no rtc node is present on this system" then ( ihandle )
r " get-time" r@ $call-method ( <returned args - 6 of em?
Yikes > ) r> close-dev ( <returned args> ) ;
: get-time s" rtc" s" get-time" execute-device-method 0= ABORT" Sorry but no rtc node is present on this system" ;
(note that ABORT" takes a flag as input), but better is
: get-time s" rtc" s" get-time" execute-device-method 0= IF fake-some-sort-of-plausible-time-1970-or-so THEN ;
which is pretty much what Apple's OF does. execute-device-method is not the same thing as open-dev followed by $call-method: it does not call "open" in the instance for the device itself (you only need that for devices that can have multiple clients at the same time and need to keep state for each client; or when instead you need to prevent concurrent access from multiple clients, by having the second open fail).
Segher