Console Clock / Processor Execution Speed:

I've just designed a Console Clock and I wanted to know if it's possible to know or calculate the speed that each line of code executes so I could increase the clocks accuracy without the use of the <ctime> library. Is it different for different systems etcetera?


Here is my current code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "stdafx.h"
#include "iostream"
#include "windows.h"
using namespace std;

int main()
{
	int A0 = 0;
	int A1 = 0;
	int A2 = 00;
	int A3 = 00;
	while (A0 != -1){
		HWND console = GetConsoleWindow();
		MoveWindow(console, 450, 430, 160, 50, TRUE);
				
		if (A0 < 1500){
			cout << A3 << " : " << A2 << " : " << A1 << "  " << A0 << endl;
			A0++;
			}
		else {
			cout << A3 << A2 << " : " << A1 << "  " << A0 << endl;
			A0= 0;
			A1++;
			if (A1>59){ 
				A2 = A2++;
				A1 = 0;
				if (A2 > 59){
					A3 = A3++;
					A1 = 0;
					A2 = 0;
					if (A3 > 12){
						A1 = 0;
						A2 = 0;
						A3 = 0;
					}
				}
			}
		}
		}	
		return 0;
}
The optimiser will rearrange your code, so you may not have those lines of code.

Here's a link to timing functions and their resolutions.
http://webbusy.wordpress.com/2010/10/25/c-time-times/
Topic archived. No new replies allowed.