Hi...this (semplified) code wait till I press a key, then it looks for the seconds elapsed.
But I want to divide them into hours/minute/seconds and not only seconds.. the algo I've wrote it's wrong (but it seems ok to me)
... can u help me ?
thanx for your attentionCode:#include <stdio.h> #include <time.h> int main () { time_t start,end, timer; char Input [256]; double dif; int ore; //hours int minuti; //minutes int secondi; //seconds timer=time(NULL); time (&start); printf("Workunit Started --> %s",asctime(localtime(&timer))); gets (Input); time (&end); dif = difftime (end,start); timer=time(NULL); printf("Workunit Completed --> %s\n",asctime(localtime(&timer))); // that's wrong !!! ore = dif/216000; minuti = (dif-(ore*216000))/3600; secondi = dif-((ore*216000)-(minuti*3600)); printf ("Time elapsed : %d:%d:%d \n", ore,minuti,secondi ); system("PAUSE"); return 0; }



LinkBack URL
About LinkBacks
)



