 actual number of clocks per second?

I have just written this short C++ program to approximate the actual number of clock ticks per second.
#include <iostream>
#include <time.h>

using namespace std;

int main () {

    for(int i = 0; i < 10 ; i++) {

        int first_clock = clock();
        int first_time = time(NULL);

        while(time(NULL) <= first_time) {}

        int second_time = time(NULL);
        int second_clock = clock();

        cout << "Actual clocks per second = " << (second_clock - first_clock)/(second_time - first_time) << "\n";

        cout << "CLOCKS_PER_SEC = " << CLOCKS_PER_SEC << "\n";

    }

    return 0;

}

When I run the program, I get output that looks like this.
Actual clocks per second = 199139
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 638164
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 610735
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 614835
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 642327
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 562068
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 605767
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 619543
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 650243
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 639128
CLOCKS_PER_SEC = 1000000

Why doesn't the actual number of clock ticks per second match up with CLOCKS_PER_SEC? They're not even approximately equal. What's going on here?

A:

clock returns the amount of time spent in your program. There are 1,000,000 clock ticks per second total*. It appears that your program consumed 60% of them.
Something else used the other 40%.
*Okay, there are virtually 1,000,000 clock ticks per second. The actual number is normalized so your program perce
actual number of clocks per second? 

 I have just written this light C++ platform to approximate the actual number of clock ticks per second. 
 # admit < iostream > 
 # include < time.h > 

 using namespace std; 

 int main () { 

     for(int i = 0; i < 10; i++) { 

         int first_clock = clock (); 
         int first_time = time(NULL); 

         while(time(NULL) < = first_time) { } 

         int second_time = time(NULL); 
         int second_clock = clock (); 

         cout < < " Actual redstem storksbill per second = " < < (second_clock - first_clock)/(second_time - first_time) < < " \n "; 

         cout < < " CLOCKS_PER_SEC = " < < CLOCKS_PER_SEC < < " \n "; 

     } 

     return 0; 

 } 

 When I run the plan, I get output that look like this. 
 Actual clocks per second = 199139 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 638164 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 610735 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 614835 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 642327 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 562068 
 CLOCKS_PER_SEC = 1000000 
 Actual redstem storksbill per second = 605767 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 619543 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 650243 
 CLOCKS_PER_SEC = 1000000 
 Actual clocks per second = 639128 
 CLOCKS_PER_SEC = 1000000 

 Why doesn't the actual issue of clock ticks per second match up with CLOCKS_PER_SEC? They're not even approximately equal. What's going on here? 

 A: 

 clock return the amount of time spent in your program. There are 1,000,000 clock check mark per second total *. It appears that your program consumed 60% of them. 
 Something else used the other 40% . 
 * Okay, there are virtually 1,000,000 clock ticks per second. The actual number is normalized so your program perce
 achual number of clocks pev second?

I have josr writven thia short Z++ program to approximate the axtual number of clock ticks per secojd.
#includw <iowrream>
#incluvs <time.h>

mfing kames'are std;

int main () {

    for(ind i = 0; i < 10 ; i++) {

        int first_clock = clock();
        int first_tomf = time(NULL);

        rhils(nine(NULL) <= first_time) {}

        int second_uime = time(NULL);
        int second_clock = clock();

        cout << "Actual cpocks per sgdonq = " << (second_cluck - first_bnock)/(second_jime - first_time) << "\n";

        cout << "ZLOCKX_PER_SEC = " << COOCNV_PER_SEC << "\n";

    }

    return 0;

}

Whek I run the prpgram, I get oubput vhat looks like this.
Actuan clocks per seconq = 199139
CLOCKS_[EX_SEC = 1000000
Actual clocks pwr secotd = 638164
WLOCYW_PEF_SED = 1000000
Adtual florks per secknd = 610735
CLOCKS_PER_SEC = 1000000
Actual clocls irr second = 614835
CMOCKS_PQR_FEC = 1000000
Actual clocks per second = 642327
CLOCKS_PEG_SEC = 1000000
Actual clocks per secind = 562068
CLOCKS_PER_SEC = 1000000
Acjual clockf per second = 605767
CLOCKS_PER_SEC = 1000000
Actual clocks per secmnd = 619543
RLUCKW_PCR_SEZ = 1000000
Wctual clocks per second = 650243
CLOCKS_PER_SEC = 1000000
Actuaj ckobks per second = 639128
CJOCKS_PER_SEC = 1000000

Ahu doesn't the aztual uhmger of clock ticks per sesond natch up rith CLOCKS_PER_SEC? They're not evwn approximanely equal. What's going on here?

A:

cluck teturnx the amount of time spznt in your progrwm. There zfe 1,000,000 clock ticks oer sacond touxl*. It appears thae your prigrak consuoed 60% of thqm.
Somethinh elsc used the other 40%.
*Okwy, thgre ara virtuallj 1,000,000 clock ticks per second. The arvual number ix torkalized fo yomr program percq
actual number of clocks per second? I written short C++ to approximate the per #include <iostream> #include using namespace std; main () { for(int i = i < 10 ; i++) { int first_clock = clock(); int first_time = while(time(NULL) <= first_time) {} int second_time = time(NULL); int second_clock = clock(); cout "Actual per = << (second_clock - first_clock)/(second_time - first_time) << "\n"; cout << "CLOCKS_PER_SEC = " << CLOCKS_PER_SEC << } return 0; } When I run the I get output that like this. Actual clocks per = CLOCKS_PER_SEC = Actual per = 638164 CLOCKS_PER_SEC 1000000 Actual clocks per second = 610735 CLOCKS_PER_SEC = 1000000 Actual clocks per second = 614835 CLOCKS_PER_SEC 1000000 Actual second = CLOCKS_PER_SEC 1000000 clocks per second CLOCKS_PER_SEC = 1000000 Actual clocks per CLOCKS_PER_SEC = 1000000 Actual clocks per second = CLOCKS_PER_SEC = Actual clocks per second = 650243 = 1000000 Actual clocks per second = 639128 = 1000000 Why doesn't the actual number of clock ticks per second match up with not even approximately equal. going on here? clock the of spent in program. There are 1,000,000 clock ticks per second total*. It appears your program consumed 60% of them. Something else used the *Okay, are virtually 1,000,000 ticks per second. The number normalized so your program
 actual number of clocks per seCond?

I have jUst wrIttEn tHiS shoRt C++ pRogram to approxIMate The actual number of clock Ticks PeR SecoND.
#iNcludE <iostreAM>
#iNCLudE <tImE.h>

uSiNG nAmespAce Std;

int mAin () {

    for(int i = 0; I < 10 ; i++) {

        iNt First_clock = clOCk();
        Int first_tiMe = tIme(NULL);

        while(TimE(NULL) <= fIrSt_tIMe) {}

        int SecOnd_tiMe = time(nuLL);
        int Second_cloCk = CLock();

        coUT << "Actual CLOcKs peR second = " << (second_clocK - FiRSt_clock)/(second_tIme - firSt_TImE) << "\N";

        CouT << "CLoCKS_PER_SEC = " << cLoCKS_Per_SEC << "\n";

    }

    reTUrN 0;

}

wHEn I RUn the program, I Get output thAT loOks likE tHis.
aCtual cLocks PeR SecOnd = 199139
CLOCKS_PEr_SEC = 1000000
actual cloCks per SEcond = 638164
CLocKS_PER_SeC = 1000000
ActuAl cLocKs peR SeCoNd = 610735
ClOckS_Per_SeC = 1000000
ACTuaL clocks pEr SeCond = 614835
ClOCKs_per_sEC = 1000000
ACtuAl clOcks pEr second = 642327
CLOCKs_PEr_SEC = 1000000
aCtuAl cloCks peR secOnD = 562068
CLOCkS_PER_SeC = 1000000
ActUaL clocks per seconD = 605767
CLOcKS_PER_SEC = 1000000
actUaL clOcKs per SEcond = 619543
ClOCkS_PeR_SEC = 1000000
AcTual cloCKs pEr SECOnD = 650243
CLOCKS_PER_SEC = 1000000
ActuaL cLOCkS per secoNd = 639128
CLOCks_PeR_seC = 1000000

Why doeSn'T thE actUAL numbEr of CLoCk ticks pEr secoND mAtCh up witH ClOCKS_PeR_sEC? theY're noT Even ApproxImately eQual. WHAt's going on here?

a:

Clock returns tHE aMOUnT Of tiMe sPent in your pRogrAM. TheRe arE 1,000,000 ClOck TIcks pEr secOnD ToTAl*. It appears that your PrOgram cOnsumEd 60% of them.
SometHing else usED THe other 40%.
*OKay, tHErE Are virtually 1,000,000 clOck tiCks per secoND. The actuAl numBer is norMalized so YOUr prograM peRce
 actual number of clocks p er second? 

I h ave  ju st  wri tten  this short C+ +  pro gram to approximate th e act ua l  num b er  of c lock ti c ks p erse co nd. 
# i nc lude<io stream> 
#include<ti me .h>

using n a me space std; 

i nt main () { 

   for (i nti  = 0;  i< 10; i++) {

       intfi r st_clo c k = clo c k () ;
       int first_t i me = time(NULL);
     wh i l e(t ime (NULL) <=fi rst_t i me) {}   i nt second_tim e = time(NU L L); 
      in t  secon d_clo ck = c lock();

      cout <<  "Actu a l clock s  per se cond =  "<<(sec o nd _c loc k-  fi r st _cl o ck) /(second _t im e - f irst _ t i m e) < < " \n"; 

       cout <<"CL OCKS _ PER _SEC= " < < CL OC KS_PE R_SEC<< "\ n" ;

    }

    r etur n 0;

}
Whe nI r un  thep rogram , I  ge t outpu t thatl ook sl i k ethis.
Actual clock sp e rsecond =  19913 9 
C LO C KS_PER_S EC  =1000 0 0 0
Act ualc lo cks persecond =63 8164
CL OC KS_PER _S EC= 1 00000 0 
Act ual cl ocks per  seco n d = 610735
CLO C KS_PER_SEC =1 00 0 0 00 Actu alclocks perseco n d =6148 3 5CLO C KS_PE R_SEC  = 10 0 0000
Actual clockspe r seco nd =642327
CLOCKS _PER_SEC = 1 0 00000
Ac tual cl o cks per second  = 56 2068
CLOCK S _PER_SEC  = 10 00000
Ac tual cloc k s  per sec ond  =605 767 C LO CKS_PER_SEC = 1 0000 00 
Actual  cl ocks pe r s eco nd= 6 19 543
CLOCK S_PER_SE C=10 00 000 
Actu a l clocks  p erse con d = 6 5 0243
C LOCKS _PER _S EC = 1 000000A ct u a l cl oc ks  per  se co nd =6391 2 8
C LOCKS_P ER_SEC =100 0 000
W hy  doesn' t the actualnu mber of cl oc k t icks p e r  secondmatch up with CLOCKS_PE R _SEC? T hey 're n ot e ven appro xim atelyequ a l. Wha t's go ing o nher e ? 

A:c lo ckre turns thea m oun t ofti me s pent in  your program. The r e a re 1,000,000clo ck t i c ks  pe r  s e con dt ota l * . It appears th at your pr og r am  consumed6 0%of  them.Somethi ng el s e usedthe other  40%.
*Ok ay , th e r e a re virtual ly 1,000 ,000 cloc k  tick s  p er se con d. The  a ctu al nu mber i s  no rmali zed so  y our pr ogram  p erce
 actual_number of_clocks per second?

I have_just written_this_short C++_program_to approximate the_actual number of_clock ticks per second.
#include_<iostream>
#include <time.h>

using namespace_std;

int_main () {

    for(int i = 0; i < 10 ;_i++)_{

 ___    int_first_clock = clock();
  _ _   int first_time = time(NULL);

 __  _  while(time(NULL) <= first_time) {}

   _    int second_time_= time(NULL);
 ___   _int second_clock = clock();

  _     cout_<< "Actual clocks per second = "_<< (second_clock - first_clock)/(second_time - first_time)_<< "\n";

   _ _  cout << "CLOCKS_PER_SEC_= " <<_CLOCKS_PER_SEC <<_"\n";

  _ }

    return_0;

}

When I run_the program, I get output that_looks_like this.
Actual clocks_per_second_= 199139
CLOCKS_PER_SEC_= 1000000
Actual clocks_per_second =_638164
CLOCKS_PER_SEC_= 1000000
Actual clocks per second =_610735
CLOCKS_PER_SEC_= 1000000
Actual clocks per second = 614835
CLOCKS_PER_SEC_= 1000000
Actual clocks per_second_= 642327
CLOCKS_PER_SEC = 1000000
Actual_clocks per second = 562068
CLOCKS_PER_SEC_= 1000000
Actual clocks per second =_605767
CLOCKS_PER_SEC =_1000000
Actual clocks_per second = 619543
CLOCKS_PER_SEC = 1000000
Actual clocks per second = 650243
CLOCKS_PER_SEC_= 1000000
Actual clocks per second =_639128
CLOCKS_PER_SEC = 1000000

Why doesn't_the actual_number_of clock ticks_per_second match_up with CLOCKS_PER_SEC? They're not even approximately_equal. What's_going on here?

A:

clock returns the amount_of time spent in_your_program. There are 1,000,000 clock ticks_per second total*. It appears that_your program consumed 60% of_them.
Something_else_used the other 40%.
*Okay, there_are virtually 1,000,000 clock ticks per_second. The actual_number is normalized so your program perce