Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

## #1 2011-12-18 06:16:39

model
Full Member

Offline

### Understanding Time of programing code in c++

Hi ,

I get the time of each line of code of my program .

Program :

cout<<" timeBeginPeriod : " << timeBeginPeriod(1) <<endl; //Add Winmm.lib in Project
cout<<" start Time : " << ( (double)GetTickCount() )/1000<<endl;
cout<<" Hi "<< ( (double)GetTickCount() )/1000<<endl;
cout<<" Hi , 123 456 "<< ( (double)GetTickCount() )/1000<<endl;

Note : GetTickCount()  give me number of milisecs . ./

And i get this

timeBeginPeriod : 0
start Time : 137809
Hi 137809
endTimer : 0

Which mean , each line of code taking time  " 137809 " in secs .
My question is What does mean by 137809 . Does it mean its taking that its taking 17 secs  and 809 milisec ?

Maths is Doctor that make our life easy ..

https://www.facebook.com/groups/Maths.GIS/

## #2 2011-12-18 06:24:07

model
Full Member

Offline

### Re: Understanding Time of programing code in c++

#### model wrote:

Hi ,

I get the time of each line of code of my program .

Program :

cout<<" timeBeginPeriod : " << timeBeginPeriod(1) <<endl; //Add Winmm.lib in Project
cout<<" start Time : " << ( (double)GetTickCount() )/1000<<endl;
cout<<" Hi "<< ( (double)GetTickCount() )/1000<<endl;
cout<<" Hi , 123 456 "<< ( (double)GetTickCount() )/1000<<endl;

Note : GetTickCount()  give me number of milisecs . ./

And i get this

timeBeginPeriod : 0
start Time : 137809
Hi 137809
endTimer : 0

Which mean , each line of code taking time  " 137809 " in secs .
My question is What does mean by 137809 . Does it mean its taking that its taking 17 secs  and 809 milisec ?

I think its means 20sec and 809 milisec . Right ?
if  so that mean in c++ each line of code take 20 secs and 809 mili secs .  hmmmm ............

Maths is Doctor that make our life easy ..

https://www.facebook.com/groups/Maths.GIS/

## #3 2011-12-18 07:50:30

bobbym
Administrator

Online

### Re: Understanding Time of programing code in c++

Hi model;

That is not your exact output, what happened to the 123456?

Also 137809 is 137 seconds and 809 milliseconds.

Something is not right but GetTickCount()  is incremental so if two of them are the same that means 0 time occurred between two lines.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## #4 2011-12-18 07:56:54

model
Full Member

Offline

### Re: Understanding Time of programing code in c++

#### bobbym wrote:

Hi model;

That is not your exact output, what happened to the 123456?

Also 137809 is 137 seconds and 809 milliseconds.

Something is not right but GetTickCount()  is incremental so if two of them are the same that means 0 time occurred between two lines.

ahh hy 123456 is inside cout just  for showing some output .that is not time .

Maths is Doctor that make our life easy ..

https://www.facebook.com/groups/Maths.GIS/

## #5 2011-12-18 08:00:43

model
Full Member

Offline

### Re: Understanding Time of programing code in c++

Actually , i have moving objects presented in video . i calculated  distance .   I  need to find speed . I am thinking that where should i add statement to get time and use it for speed calculation,. for deciding that i need to understand time meaning w,r,t  code.

Well could you  please tell me that how  are u say : 137809 is 137 seconds and 809 milliseconds.  ?

Maths is Doctor that make our life easy ..

https://www.facebook.com/groups/Maths.GIS/

## #6 2011-12-18 08:05:49

bobbym
Administrator

Online

### Re: Understanding Time of programing code in c++

The GetTickCount() function if I remember counts in milliseconds from the start of the machine.

So there are 137809 milliseconds, when you divide by 1000 ( there are 1000 milliseconds in a second ) you will get 137 seconds and 809 milliseconds.

In mathematics, you don't understand things. You just get used to them.
I have the result, but I do not yet know how to get it.
All physicists, and a good many quite respectable mathematicians are contemptuous about proof.

## Board footer

Powered by FluxBB