aldweb

Fermer I. aldweb

Fermer II. Gratuitiels PC

Fermer III. Gratuitiels Palm

Fermer IV. Partagiciels Palm

Fermer V. iziBasic Palm

Fermer VI. Connaissance Palm

Fermer VII. Ordinateur Poche

Fermer VIII. miniPortail

Spécial !



Version mobile
de l'aldweb Site

m.aldweb.com


Ni Français, ni Anglais ?

Essayez donc l'un de ces drapeaux :
[de] [es] [it] [pt]
Recherche




Météo / Spam / www

Météo Lyon


aldweb contre le SPAM


Newsletter
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
S'abonner
Se désabonner
298 Abonnés
Sites web de la famille

Webmaster - Infos
News Amis
Visites

   visiteurs

   visiteurs en ligne

Sondage
Comment trouve-tu le nouvel habillage de l'aldweb Site ?
 
Superbe !
Joli
Moyen
Moche...
Résultats
forum.gifForum - iziBasic - Sujet n°1616

Forum - Forum
iziBasic - iziBasic


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

actif  Sujet n° 1616  How does TICKSPERSEC work?

le 11/07/2008 @ 08:47
par Gary

Anonyme



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.
  Poster une réponse  Haut

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

Anonyme

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

I inverted T and U.

U is increasing and T=100
  Poster une réponse  Haut

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

Anonyme

visiteur
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
Ecrire à aldweb   Poster une réponse  Haut
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
[]
Catégories de discussion  Forum 



 
^ Haut ^