|
From: Roger F. <ra...@ha...> - 2006-06-06 19:47:36
|
microseconds = seconds / 1000000
I don't know if the value you are retrieving is accurate to that degree
of precision, but you must devide. Remember, seconds * 60 = minutes.
Aloha,
Roger
David Chu wrote:
> Hi All,
>
> I've a question on how to convert struct timeval into microsecond.
>
> #include <sys/time.h>
> struct timeval {
> time_t sec;
> suseconds_t usec;
> };
>
> What I'm doing right now is the follow:
>
> struct timeval currentTime;
> long timeInLong;
>
> gettimeofday(¤tTime, 0);
>
> // converts sec to microseconds
> timeInLong = currentTime.tv_sec * 1000000;
>
> // Adds the microsecond together with the converted second.
> timeInLong += sendTime.tv_usec;
>
> Does this look correct to you guys?
>
> Thanks,
>
> David
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|