bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "getTicks() in ms" to add for WIN32 and Linux to commonc++?


From: David Sugar
Subject: Re: "getTicks() in ms" to add for WIN32 and Linux to commonc++?
Date: Fri, 2 Jan 2004 10:35:01 -0500
User-agent: KMail/1.5.3

I recall in reviewing recent changes in ccrtp, that Federico had to add a 
simulated gettimeofday function for supporting w32 builds.  So perhaps both 
of these functions, if needed for different things, should end up with a 
representation in the Common C++ 1.1 reorganized "missing" module for library 
functions missing from some platforms (missing.h/missing.cpp) ...

On Friday 02 January 2004 07:49 am, Wolfgang wrote:
> Would it make sense to add a getTicks() type function to the CommonC++
> framework? Or do you think it is so trivial that it does not need to be
> there? I run into this recently when porting a project from linux to win32
> using commonc++.
> Here a draft for for win32 and linux.
>
>
>
> #ifndef WIN32
> #include <sys/time.h>
> #else
> #include <time.h>
> #include <windows.h>
> #endif //win32
>
>
> //return number of ticks in ms
> long getTicks();
>
>
> ifdef WIN32
> long getTicks() {
>       return GetTickCount();
> };
> #else
> long getTicks() {
>       long ticks;
>       struct timeval now;
>       gettimeofday(&now, NULL);
>       ticks = now.tv_sec * 1000l;
>       ticks += now.tv_usec / 1000l;
>       return ticks;
> };
> #endif
>
>
>
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp





reply via email to

[Prev in Thread] Current Thread [Next in Thread]