aldweb

Close I. aldweb

Close II. PC Freeware

Close III. Palm Freeware

Close IV. Palm Shareware

Close V. iziBasic Palm

Close VI. Palm Knowledge

Close VII. Pocket Computer

Close VIII. miniPortail

Special !



Mobile version of
the aldweb Site

m.aldweb.com


Neither French, nor English?

Try one of these flags then:
[de] [es] [it] [pt]
Search




Weather / Spam / www

Lyon Weather


aldweb against spam


Newsletter
To receive news about this website, consider subscribing to our Newsletter.
Subscribe
Unsubscribe
298 Subscribers
Family's web sites

Webmaster - Infos
Friends News
Visits

   visitors

   visitors online

Poll
What do you think of the new design of the aldweb Site?
 
Great !
Beautiful
Average
So ugly...
Results
forum.gifForum - iziBasic - Topic #1616

Forum - Forum
iziBasic - iziBasic


Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257

active  Topic # 1616  How does TICKSPERSEC work?

11/07/2008 @ 08:47
by Gary

Anonymous



I am writing a timer program that counts down until it reaches zero. I want it to count down by seconds, but I don't understand TICKSPERSEC.

I wrote this to view TICKSPERSEC and TICKS.

T=TICKSPERSEC
U=TICKS

Then I printed T and U to the screen and T is constintly increasing and U=100.

T continues to increases every time I run the program, but U stays at 100.

What is TICKSPERSEC and TICKS. And how do I use TICKSPERSEC and TICKS to time my program.
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 1
--------
11/07/2008 @ 10:16
by Gary

Anonymous

visitor
Sorry, but I must be tired from this late night coding.

I inverted T and U.

U is increasing and T=100
  Post an answer  Top

Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Answer n° 2
--------
11/07/2008 @ 12:48
by aldweb

Anonymous

visitor
The CPU has an internal clock which beats on a regular basis thanks to an integrated quartz. Each time it beats (or "ticks"), it will increment a counter.
To convert this counter to our standard time measurement system (hours, minutes, seconds), we need to know how many quartz beats happen in one second.

Then:
TICKS returns this quartz' beating counter
TICKSPERSEC returns the number of beats per second

So, retrieve the counter once, do something, retrieve the counter a second time, calculate the number of beats that happened while doing this thing, divide by the number of beats per second, and you will know how long it took to do that
thing. Got it?

Sample:

BEGIN
T=TICKS 'retrieve initial tick
FOR I=1 TO 100 'do something important...
NEXT
T=(TICKS-T)/TICKSPERSEC 'magic formula!
PRINT T 'number of seconds required to do our important thing
WAIT
END


Cheers,
aldweb
Write to aldweb   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
[]
Forum Topic  Forum 



 
^ Top ^