2 This file is part of libmspframework
3 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
4 Distributed under the LGPL
6 #include <sys/resource.h>
17 Returns the current timestamp.
23 return TimeStamp(tv.tv_sec*1000000LL+tv.tv_usec);
27 Returns the CPU time used by the program so far.
29 TimeDelta get_cpu_time()
32 getrusage(RUSAGE_SELF, &ru);
33 return (ru.ru_utime.tv_sec+ru.ru_stime.tv_sec)*sec + (ru.ru_utime.tv_usec+ru.ru_stime.tv_usec)*usec;
37 Sleeps for the given time.
39 int sleep(const TimeDelta &d)
44 return nanosleep(&ts, 0);