lua-users home
lua-l archive

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


You might try this instead:

#define kSamples 100

unsigned long samples[kSamples];

for (int i = 0; i < kSamples; i++) {
    samples[i] = clock();
}
for (int i = 0; i < kSamples; i++) {
    printf("%ld, ", samples[i]);
}

Russ

> From: Enrico Colombini <erix@erix.it>
> Reply-To: lua-l@tecgraf.puc-rio.br
> Date: Wed, 12 Jun 2002 17:15:31 +0200
> To: Multiple recipients of list <lua-l@tecgraf.puc-rio.br>
> Subject: RE: Off topic: Win32 time function
> 
>> These might be deceiving.
>> The count returned might be in 1000 ticks per second, but
>> the actual resolution might be way less than that.
>> 
>> Vincent Penquerc'h
> 
> You are right. I wrote this to check it out:
> 
> for (int i = 0; i < 100; i++) {
> printf("%ld, ", clock());
> }
> 
> The result (Borland C++ Builder 3, Windows 98) on my machine is:
> 
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2,
> 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
> 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10,
> 10, 10, 10, 10, 10, 10, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
> 18, 18, 18, 18, 18, 18, 18, 18,
> 
> So the actual resolution seems to be approx. 2 ms, unless I am mistaken.
> 
> Enrico
>