From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eb6461ca23607ed4 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Stopwatch project Date: 1999/04/25 Message-ID: #1/1 X-Deja-AN: 470839281 References: <924946678.23882.0.nnrp-04.c2de4c02@news.demon.co.uk> NNTP-Posting-Date: Sun, 25 Apr 1999 16:26:28 PDT Newsgroups: comp.lang.ada Date: 1999-04-25T00:00:00+00:00 List-Id: "Brian A Crawford" writes: > I have found on page 914-915 of 'Ada as a Second Language' a package called > Stopwatch but find no example on how to use it (and the fact that it is on > page 914 is not lost on a beginner :-) ). > > Any help would be extremely greatly appreciated. Here is a test driver. It does something similar to what you want, but without using Get_Immediate. My run-time is broken, so when I run this program, it dumps core. Try it yourself and see if it works. Matt --STX with Stopwatch; with Ada.Text_IO; use Ada.Text_IO; procedure Test_Stopwatch is C : Character; begin Main: loop Get (C); case C is when 'r' | 'R' => Stopwatch.Reset; Put_Line ("Stopwatch has been reset."); when ' ' => Stopwatch.Start; Put_Line ("Stopwatch has been started."); when 's' | 'S' => Stopwatch.Stop; Put_Line ("Stopwatch stopped; total time is " & Duration'Image (Stopwatch.Total_Time) & "."); when 'x' | 'X' => exit Main; when others => Put_Line ("Bad input."); end case; end loop Main; end Test_Stopwatch;