ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

microsecond-accurate timing on Windows
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Vincent Diepeveen



Joined: 09 Mar 2006
Posts: 1738
Location: The Netherlands

PostPost subject: Re: microsecond-accurate timing on Windows    Posted: Mon May 28, 2012 7:37 pm Reply to topic Reply with quote

mar wrote:
diep wrote:

Maybe ask in graphics group if you want such turbo framerate in OpenGL.

Hopefully your users are all on some new sort of AICAR drugs, the new undetectable form of EPO, gonna be problem in London. Your users really need some superdrug like that if they want to make chance keep up with 150 frames per second game.

LOL Smile No need for drugs. Depends on how fast stuff moves, not on framerate.

The problem is that with vsync on, say monitor does 75Hz. But with 16ms granularity I get 63Hz. What happens is that one frame in that case is 0ms and another 32ms, so I get nonuniformly distributed logic update rate of about 32Hz, which certainly doesn't look smooth. But I agree that we're a bit off topic here. timeGetTime did the trick. Thanks for your answers anyway.


Are you sure about timeGetTime()?

It has 100% same behaviour like GetTickCount() here.
Look:
Code:

#include <windows.h>
#include <Mmsystem.h>
#include <stdio.h>

#define BITBOARD unsigned long long

int main(void) {
  unsigned long long nattempts = 0ULL;
  unsigned int x, i = 0, dummy;


  if( timeBeginPeriod(1) == TIMERR_NOERROR )
    printf("set timer\n");
  else
    printf("error setting timer\n");
 
  x = (unsigned int)timeGetTime();//GetTickCount();   
  while( i < 50 ) {
    unsigned int newx = (unsigned int)timeGetTime();//GetTickCount();
    nattempts++;
    if( newx != x ) {
      unsigned int delta = newx - x;
      printf(" delta = %u totalreads = %llu\n",
       delta,nattempts);
      x = newx;
      i++;
    }   
  }

  if( timeEndPeriod(1) == TIMERR_NOERROR ) printf("ended timer\n");

  return 0;
}

/*

C:\test>ticktock
set timer
delta = 1 totalreads = 6731
delta = 35 totalreads = 6732
delta = 36 totalreads = 6733
delta = 36 totalreads = 6734
delta = 36 totalreads = 6735
delta = 36 totalreads = 6736
delta = 37 totalreads = 6737
delta = 36 totalreads = 6738
delta = 36 totalreads = 6739
delta = 36 totalreads = 6740
delta = 36 totalreads = 6741
delta = 36 totalreads = 6742
delta = 38 totalreads = 6743
delta = 36 totalreads = 6744
delta = 36 totalreads = 6745
delta = 36 totalreads = 6746
delta = 36 totalreads = 6747
delta = 37 totalreads = 6748
delta = 36 totalreads = 6749
delta = 36 totalreads = 6750
delta = 36 totalreads = 6751
delta = 36 totalreads = 6752
delta = 36 totalreads = 6753
delta = 37 totalreads = 6754
delta = 35 totalreads = 6755
delta = 36 totalreads = 6756
delta = 36 totalreads = 6757
delta = 36 totalreads = 6758
delta = 36 totalreads = 6759
delta = 37 totalreads = 6760
delta = 36 totalreads = 6761
delta = 36 totalreads = 6762
delta = 36 totalreads = 6763
delta = 36 totalreads = 6764
delta = 36 totalreads = 6765
delta = 36 totalreads = 6766
delta = 36 totalreads = 6767
delta = 36 totalreads = 6768
delta = 36 totalreads = 6769
delta = 36 totalreads = 6770
delta = 36 totalreads = 6771
delta = 37 totalreads = 6772
delta = 36 totalreads = 6773
delta = 36 totalreads = 6774
delta = 36 totalreads = 6775
delta = 36 totalreads = 6776
delta = 36 totalreads = 6777
delta = 36 totalreads = 6778
delta = 36 totalreads = 6779
delta = 36 totalreads = 6780
ended timer

C:\test>

*/
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Subject Author Date/Time
microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 10:20 am
      Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 12:56 pm
      Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 2:44 pm
            Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 3:22 pm
                  Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 3:30 pm
                        Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 5:10 pm
                              Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 7:05 pm
            Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 3:36 pm
                  Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 3:39 pm
                        Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 5:20 pm
                              Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 6:23 pm
                                    Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 7:13 pm
                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 7:18 pm
                                                Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 8:33 pm
                                                      Re: microsecond-accurate timing on Windows Aleks Peshkov Tue May 29, 2012 7:50 am
                                                            Re: microsecond-accurate timing on Windows Martin Sedlak Tue May 29, 2012 8:26 am
                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon May 28, 2012 7:37 pm
                                                Re: microsecond-accurate timing on Windows Martin Sedlak Mon May 28, 2012 8:07 pm
                                                      Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 12:44 pm
                                                            Re: microsecond-accurate timing on Windows Martin Sedlak Tue May 29, 2012 1:15 pm
                                                                  Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 3:07 pm
                                                                        Re: microsecond-accurate timing on Windows Martin Sedlak Tue May 29, 2012 4:38 pm
                                                      Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 12:55 pm
                                                      Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 1:11 pm
                                                            Re: microsecond-accurate timing on Windows Martin Sedlak Tue May 29, 2012 1:29 pm
                                                                  Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 3:18 pm
                                                                        Re: microsecond-accurate timing on Windows Martin Sedlak Tue May 29, 2012 5:00 pm
                                                                              Re: microsecond-accurate timing on Windows Wylie Garvin Tue May 29, 2012 9:38 pm
                                                                                    Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 9:48 pm
                                                                                          Re: microsecond-accurate timing on Windows Martin Sedlak Wed May 30, 2012 9:10 am
                                                                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Fri Jun 01, 2012 9:24 am
                                                                                          Re: microsecond-accurate timing on Windows Martin Sedlak Fri Jun 01, 2012 10:52 am
                                                                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Sat Jun 02, 2012 3:36 pm
                                                                                          Re: microsecond-accurate timing on Windows Martin Sedlak Sun Jun 03, 2012 7:45 am
                                                                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon Jun 04, 2012 11:25 am
                                                                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Mon Jun 04, 2012 11:39 am
                                                                                          Re: microsecond-accurate timing on Windows Martin Sedlak Mon Jun 04, 2012 12:31 pm
                                                                                          Re: microsecond-accurate timing on Windows Martin Sedlak Mon Jun 04, 2012 12:12 pm
                                                                                    Re: microsecond-accurate timing on Windows Martin Sedlak Wed May 30, 2012 9:13 am
                                                                                          Re: microsecond-accurate timing on Windows Vincent Diepeveen Fri Jun 01, 2012 9:29 am
                                                                        Re: microsecond-accurate timing on Windows Martin Sedlak Tue May 29, 2012 5:25 pm
                                                                              Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 7:19 pm
                                                                                    Re: microsecond-accurate timing on Windows Martin Sedlak Wed May 30, 2012 11:41 am
                                                                                          Re: microsecond-accurate timing on Windows Thomas Petzke Wed May 30, 2012 2:57 pm
                                                                              Re: microsecond-accurate timing on Windows Vincent Diepeveen Tue May 29, 2012 7:27 pm
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads