(***************************************************************************

     $RCSfile: TimerUtil.mod $
  Description: Support for clients of timer.device

   Created by: fjc (Frank Copeland)
    $Revision: 1.2 $
      $Author: fjc $
        $Date: 1994/05/12 19:44:12 $

  Copyright © 1994, Frank Copeland.
  This file is part of the Oberon-A Library.
  See Oberon-A.doc for conditions of use and distribution.

  Log entries are at the end of the file.

***************************************************************************)

MODULE TimerUtil;

(* $L+ use absolute long addressing for global variables *)
(* $Z- disable zeroing of variables *)

IMPORT T := Types, E := Exec, EU := ExecUtil, Ti := Timer;

(*------------------------------------*)
(*
 * An AmigaDOS 1.3 implementation of the AmigaDOS 2.0+ function.  Based on
 * an example in the 2nd edition RKM:Libraries and Devices.
 *)
PROCEDURE GetSysTime *
  ( VAR req  : Ti.timerequest; VAR dest : Ti.timeval );

  VAR port : E.MsgPortPtr; result : SHORTINT;

BEGIN (* GetSysTime *)
  dest.tvsecs := 0; dest.tvmicro := 0; port := NIL;
  IF req.mnReplyPort = NIL THEN
    port := EU.CreatePort (NIL, 0);
    IF port # NIL THEN
      req.mnReplyPort := port
    ELSE
      RETURN
    END; (* ELSE *)
  END; (* IF *)
  req.lnType := E.ntMessage;
  req.lnPri := 0;
  req.lnName := NIL;
  req.ioCommand := Ti.trGetSysTime;
  result := E.Base.DoIO (req);
  dest := req.trtime;
  IF port # NIL THEN EU.DeletePort (port) END;
END GetSysTime;

END TimerUtil.

(***************************************************************************

  $Log: TimerUtil.mod $
# Revision 1.2  1994/05/12  19:44:12  fjc
# - Prepared for release
#
  Revision 1.1  1994/01/15  17:56:57  fjc
  - Start of revision control

***************************************************************************)
