delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/23/11:29:20

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 23 Oct 2007 10:28:48 -0500
From: Brian Ford <Brian DOT Ford AT FlightSafety DOT com>
Reply-To: cygwin AT cygwin DOT com
To: Marcell Missura <missura AT cs DOT uni-bonn DOT de>
cc: cygwin AT cygwin DOT com
Subject: Re: milliseconds on Windows
In-Reply-To: <38624.131.220.7.1.1193151578.squirrel@webmail.iai.uni-bonn.de>
Message-ID: <Pine.CYG.4.58.0710231015060.3388@PC1163-8460-XP.flightsafety.com>
References: <38624 DOT 131 DOT 220 DOT 7 DOT 1 DOT 1193151578 DOT squirrel AT webmail DOT iai DOT uni-bonn DOT de>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Tue, 23 Oct 2007, Marcell Missura wrote:

> Hello Brian,

http://cygwin.com/acronyms/#PPIOSPE

I've redirected this message and set the Reply-To appropriately.

> I'm a student at Bonn university and I'm researching robotics. I'm trying
> to write a robot controller for Windows XP (wasn't my choice!) and
> measuring elapsed time down to milliseconds precision is crucial. Do you
> happen to remember this discussion on the cygwin mailing list?
>
> On Mon, 12 Feb 2007, Carlo Florendo wrote:
>
> <snip>
>
> Re: strange bug in gettimeofday function
>
> > Windows could be accurate up to 15 ms or perhaps a little bit more.
> > However, it is very difficult to achieve less than 15 ms or microsecond
> > accuracy with windows due to the limitation on the OS itself.  Our
> > extensive tests on windows clocks and timers reveal that windows cannot
> > be accurate to the microsecond level or below 15 ms.
> >
> > In any case, in my experience, windows cannot be accurate with a
> > precision of up to 15 milliseconds.
>
> I'm sorry, could you repeat that value one more time, just in case someone
> missed it ;-).
>
> Anyway, I don't think it is relevant to the original thread's question,
> but I can assure you that Windows can be used for accurate timings in down
> to 1 or 2 ms (depending on the OS version).
>
> </snip>
>
> I'm experiencing pretty much the same thing as this guy. I'm using
> gettimeofday() to construct a timestamp and ran a test just like this:
>

Maybe try the solution I gave "this guy" (Carlo Florendo) on the cygwin
list?

> double timestamp;
> struct timeval tv;
>
> while(1)
> {
>  gettimeofday(&tv, NULL);
>  timestamp = tv.tv_sec + (double)tv.tv_usec/1000000;
>  printf("%f\n", timestamp);
> }
>
> Output:
>
> 1193149915.220881
> ... many times ...
> 1193149915.220881
> 1193149915.230881
> ... many times ...
> 1193149915.240881
>
> and so on. The timestamp changes every 10 ms.
>
> So if you know how to measure 1ms (less would be even better) on Win XP,
> can you please tell me how to do that?

http://cygwin.com/ml/cygwin/2007-02/msg00740.html

-- 
Brian Ford
Lead Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019