•
•
•
•
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
![]() |
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
LINE
TRING;
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!
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
LINE
TRING;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!
•
•
Join Date: Jan 2005
Posts: 31
Reputation:
Rep Power: 4
Solved Threads: 0
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.Re: Can I stop the execution of the program in Dev Pascal for a certain amount of tim
#3
Aug 2nd, 2005
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!
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!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Pascal and Delphi Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Could somebody tell me more dev-pascal code? (Pascal and Delphi)
- Trying to find a better way to generate random numbers in Dev Pascal (Pascal and Delphi)
- calculate the execution time of a program (C)
- Dev Pascal string help. (Pascal and Delphi)
- Dev Pascal help! (Pascal and Delphi)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Delphi forum
- Next Thread: Creating a delphi program to autoinstall other programs?


Linear Mode