[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Re: open-axiom builds on mingw32
From: |
Gabriel Dos Reis |
Subject: |
Re: [Gcl-devel] Re: open-axiom builds on mingw32 |
Date: |
Wed, 03 Nov 2010 14:42:18 -0500 |
Camm Maguire <address@hidden> writes:
| Greetings!
|
| Gabriel Dos Reis <address@hidden> writes:
|
| > Camm Maguire <address@hidden> writes:
| >
| > | Greetings!
| > |
| > | Gabriel Dos Reis <address@hidden> writes:
| > |
| > | > Camm Maguire <address@hidden> writes:
| > | >
| > | > | Greetings, and thanks! Should be fixed now. Please let me know if
| > | > | problems persist.
| > | >
| > | > Everything builds fine this time around. Hurray!
| > | >
| > |
| > | Great!
| > |
| > | 1) Any microsecond clock function on windows like gettiemofday()?
| >
| > There are GetSystemTime and GetLocalTime to be called with a pointer to
| > a SYSTEMTIME structure. See
| >
| > http://msdn.microsoft.com/en-us/library/ms724390%28VS.85%29.aspx
| > http://msdn.microsoft.com/en-us/library/ms724950%28v=VS.85%29.aspx
| >
| >
|
| Thanks, but I need microseconds. Anyone object to:
|
|
DEFUN_NEW("GETTIMEOFDAY",object,fSgettimeofday,SI,0,0,NONE,OO,OO,OO,OO,(void),"Return
time with maximum resolution") {
| #ifdef __MINGW32__
| /* static struct timeb t0; */
| /* static unsigned u; */
| /* struct timeb t; */
| /* ftime(&t); */
| /* if (t.time!=t0.time || t.millitm!=t0.millitm) {t0=t;u=0;} */
| /* u++; */
| /* return
make_longfloat(((longfloat)t.time+1.0e-3*t.millitm+1.0e-6*(u%1000))); */
| LARGE_INTEGER uu;
| QueryPerformanceCounter(&uu);
| return make_longfloat((longfloat)uu.QuadPart*1.0e-6);
| #endif
Hmm, I think you want to divide by the the number of ticks per second
as returned by QueryPerformanceFrequency(), see
http://msdn.microsoft.com/en-us/library/ms886789.aspx
furthermore, since these days the frequence is not fixed in time and
depends on the `performance profile' of the machine at any single time,
you can't cache the value of QueryPerformanceFrequency() and reuse it.
I believe you need something like:
LARGE_INTEGER ticks;
if (QueryPerformanceFrequency(&ticks)) {
/* high resolution available. /
const double micros = 1.0e6/ticks.QuadPart;
LARGE_INTEGER snapshot;
QueryPerformanceCounter(&snapshot);
return make_longfloat(snapshot.QuadPart * micros);
else {
/* high resolution not available. Use something else. */
}
-- Gaby
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/01
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/01
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Gabriel Dos Reis, 2010/11/01
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/02
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Gabriel Dos Reis, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Gabriel Dos Reis, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32,
Gabriel Dos Reis <=
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Gabriel Dos Reis, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Gabriel Dos Reis, 2010/11/03
- Re: [Gcl-devel] Re: open-axiom builds on mingw32, Camm Maguire, 2010/11/03
- [Gcl-devel] Re: open-axiom builds on mingw32, Gabriel Dos Reis, 2010/11/27
- [Gcl-devel] 2.6.8 ...., Camm Maguire, 2010/11/03
- [Gcl-devel] Re: 2.6.8 ...., Gabriel Dos Reis, 2010/11/04
- [Gcl-devel] Re: 2.6.8 ...., Camm Maguire, 2010/11/04
- [Gcl-devel] Re: 2.6.8 ...., Gabriel Dos Reis, 2010/11/04