On Aug 14, 2008, at 5:43 PM, Pete Wyckoff wrote:
[EMAIL PROTECTED] wrote on Thu, 14 Aug 2008 18:11 -0400:
+struct timespec PINT_util_get_abs_timespec(int microsecs)
+{
+ struct timeval now;
+ struct timespec tv;
+
+ gettimeofday(&now, NULL);
+ tv.tv_sec = now.tv_sec + (microsecs / 1e6);
+ tv.tv_nsec = (now.tv_usec * 1e3) + (microsecs * 1e3);
+ return tv;
+}
I don't think this gives the nsec you want. Some integer arithmetic
and a % would help. Or you could calculate nsec first then
normalize any extra up into sec. Or do the work with timeradd() (in
tree somewhere I think?) and use TIMEVAL_TO_TIMESPEC from sys/time.h
to do the final conversion.
Thanks Pete. Went with option b. I don't think TIMEVAL_TO_TIMESPEC
is defined by default.
-sam
-- Pete
_______________________________________________
Pvfs2-developers mailing list
[email protected]
http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers