+inline
+void timestamp::stop()
+{
+ getrusage(RUSAGE_SELF, &after);
+ difference = difference + ((after.ru_utime + after.ru_stime) -
+ (before.ru_utime + before.ru_stime));
+}
+
+inline
+struct timeval timestamp::tv_duration() const
+{
+ return difference;
+}
+
+inline
+double timestamp::duration() const
+{
+ return timertod(difference);
+}
+
+inline
+void timestamp::tv_clear(struct timeval& a)
+{
+#ifdef HAVE_TIMERCLEAR
+ timerclear(&a);
+#else
+ tv.sec = tv.usec = 0;
+#endif
+}
+
+inline
+double timestamp::timertod(const struct timeval& a)
+{
+ return a.tv_sec + a.tv_usec / 1e6;
+}