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 that I'm currently working on is converted/or run as a Windows service.It was previously a Win32 console application before it is converted to run as a windows service.
I've written the test/dummy program as a Win32 console application. Which work out just fine (nevermind the slowing of the pc). The funny thing is that when I try to convert the test/dummy program to run as a Windows service, it does not works as it is supposed to be. (I've change the
printf("round %d",x++); to a writeToFile type of function).
Can anyone tell me why this is happening?
What does converting your program to run a windows service does to your program?
BTW: I'm Using MVC6 and my os is Win2K.
any kind of help will be appreciated.
additiona info:This is the solution that I've though of regarding my previous thread
Timed function in C
regards,
jaro