Skip to content

Instantly share code, notes, and snippets.

@Temptationx
Created December 23, 2013 05:07
Show Gist options
  • Save Temptationx/8091914 to your computer and use it in GitHub Desktop.
Save Temptationx/8091914 to your computer and use it in GitHub Desktop.
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
#define steps_per_second 100;
int _tmain(int argc, _TCHAR* argv[])
{
unsigned int skip_ticks = 1000/steps_per_second;
int max_script_steps_skip = 10;
bool running = true;
unsigned int next_step = GetTickCount();
DWORD start = next_step;
int count;
int loops = 0;
int datas = 0;
while(running){
count = 0;
while(GetTickCount() > next_step && count < max_script_steps_skip){
std::cout<<"script: "<<GetTickCount()<<std::endl;
next_step += skip_ticks;
count++;
loops++;
}
std::cout<<"listen: "<<GetTickCount()<<std::endl;
datas++;
if(GetTickCount()-start>=3000) break;
}
std::cout<<"scripts: "<<loops<<std::endl;
std::cout<<"listens: "<<loops<<std::endl;
std::cin.get();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment