+ struct rusage ru;
+ getrusage(RUSAGE_SELF, &ru);
+ long usr_ms = ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000;
+ long us = usr_ms/1000; int ums = usr_ms%1000;
+ long sys_ms = ru.ru_stime.tv_sec*1000 + ru.ru_stime.tv_usec/1000;
+ long ss = sys_ms/1000; int sms = sys_ms%1000;
+ printf("Cpu time: user: %ld:%02ld:%02ld.%03d sys: %ld:%02ld:%02ld.%03d\n",
+ us/3600, us%3600/60, us%60, ums, ss/3600, ss%3600/60, ss%60, sms);