Con minuti e secondi...
Nonostante per le 10.000 elaborazioni di esempio passano qualche secondo...codice:int main (int argc, char *argv[]) { time_t tempo; struct tm *data; tempo = time(NULL); data = localtime(&tempo); cout << setfill('0'); cout << setw(2) << data->tm_mday << "/"; cout << setw(2) << data->tm_mon << "/"; cout << setw(2) << data->tm_year%100 << endl; getchar(); char dest[70]; int ch; time_t temp; struct tm *timeptr; struct tm *timeptr2; temp = time(NULL); timeptr = localtime(&temp); ch = strftime(dest,sizeof(dest)-1,"Today is %A," " %d %b. \n Time: %I:%M:%S %p", timeptr); printf("%d Inizio elaborazione: \n \n %s", ch, dest); cin.get(); int n=0; for (int i=0; i<10000; i++) { n++; cout << " elaborazione di esempio... n."; cout << n; } timeptr2 = localtime(&temp); ch = strftime(dest,sizeof(dest)-1,"Today is %A," " %d %b. \n Time: %I:%M:%S %p", timeptr2); printf("%d Fine elaborazione: \n \n %s", ch, dest); cin.get(); }
l'orario di fine elaborazione è esattamente uguale a quello di inizio.
![]()

Rispondi quotando