User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Pascal and Delphi section within the Software Development category of DaniWeb, a massive community of 423,717 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,129 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Pascal and Delphi advertiser: Programming Forums
Views: 3392 | Replies: 3
Reply
Join Date: Jun 2005
Location: Italy
Posts: 12
Reputation: Shadowhawk is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Shadowhawk's Avatar
Shadowhawk Shadowhawk is offline Offline
Newbie Poster

Can I stop the execution of the program in Dev Pascal for a certain amount of time?

  #1  
Jun 24th, 2005
Hello, guys, and thank you in advance!
I am trying to make the program stop running for six seconds. I don't know, however, how to use the system clock. The code I came up with is something like this:

PROGRAM TIMER;

VAR
LINETRING;
X, S:INTEGER;

BEGIN

REPEAT
WRITE ('TYPE ANYTHING TO BEGIN: ');
READLN (LINE);
IF LINE<>'0' THEN
BEGIN
RANDOMIZE;
X := RandSeed
S := X + 6000;
REPEAT
RANDOMIZE;
UNTIL RandSeed >= S
WRITELN ('END OF TIME!');
END;
UNTIL LINE='0';

END.


It works, somehow, but it's not accurate, atleast not as acurate as a real timer. If somebody can help me, please, do so. Thank you, once more!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2005
Posts: 31
Reputation: Jackrabbit is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Jackrabbit Jackrabbit is offline Offline
Light Poster

Re: Can I stop the execution of the program in Dev Pascal for a certain amount of tim

  #2  
Jun 24th, 2005
program Timer;

{$mode objfpc}{$H+}

uses
  Classes, DateUtils, SysUtils
  { add your units here };
var
   TargetTime: TDateTime;
begin;
    TargetTime := IncSecond(Now, 6);
    repeat
    until CompareTime(Now, TargetTime) >= 0;
    WriteLn('Six seconds have elapsed!');
end.
Reply With Quote  
Join Date: Jun 2005
Location: Germany
Posts: 62
Reputation: freemind is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
freemind's Avatar
freemind freemind is offline Offline
Junior Poster in Training

Re: Can I stop the execution of the program in Dev Pascal for a certain amount of tim

  #3  
Aug 2nd, 2005
The last time when I used Pascal was ages ago, but I do remember a function delay(), i.e. delay(6); gives u a delay from 6 seconds. Maybe you need to use Crt (or if there is a new name for it) to get it - this you have to check.
Reply With Quote  
Join Date: Jun 2005
Location: Italy
Posts: 12
Reputation: Shadowhawk is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
Shadowhawk's Avatar
Shadowhawk Shadowhawk is offline Offline
Newbie Poster

Re: Can I stop the execution of the program in Dev Pascal for a certain amount of time?

  #4  
Aug 7th, 2005
I have heard of that command before, but, unfortunately, it doesn't seem to be supported by the edition of Pascal I use (that would be DevPascal). thanks for the tip, anyway!

As for the source code sant by Jackrabbit, I have no clue as to how to use units. You see, I learnt Pascal on my own, using a book written in 1990... You understand that my knowledge is not sufficient to develop something REALLY good. I appreciate your help, though! I really do!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Pascal and Delphi Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Pascal and Delphi Forum

All times are GMT -4. The time now is 1:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC