| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need some clarificaton...
Hi,
I have these ff. code: Code:
/*test/dummy progam*/
#include <time.h>
//var declaration
clock_t start, finish;
double duration;
double limit = 5.00; // roughly equal to 5 seconds
int x;
int main(){
//
//
//
start = clock();
x=1;
while(1){
finish = clock();
duration = (finish - start) / CLOCKS_PER_SEC;
if(limit < duration){
/* do stuff....*/
printf("round %d",x++); // for example
start = clock();
duration =0.00;
}
}
return 0;
}
I know that this is not resourece friendly type of code. The code above is a test/dummy program ,the program while running will execute the printf() in every 5 second. The test/dummy program works fine but when I try to insert this logic to the project that I'm currently working on , it does not work. The project mentioned here is converted/or run as a Windows service. I've written the test/dummy program as a Win32 console application. The project that I've mentioned is previously a Win32 console application before it is converted to run as a windows service. Can anyone tell me why this is happening? I'm Using MVC6 and my os is Win2K. BTW: when I tried to convert the test/dummy program run run as a Windows service, the test/dummy program does not execute - I mean does not print ( I've change the printf() to a writeToLog type of function). any kind of help will be appreciated. regards, jaro |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Need some clarificaton... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|