git-svn-id: svn://db.shs.com.ru/pip@175 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-01-30 13:45:23 +00:00
parent d044b90120
commit 57a7af0b35
2 changed files with 25 additions and 7 deletions

View File

@@ -3,6 +3,10 @@
#include "piconfig.h" #include "piconfig.h"
#include "piethernet.h" #include "piethernet.h"
void ke(PIKbdListener::KeyEvent k, void*) {
piCout << k.modifiers << k.key;
}
int main (int argc, char * argv[]) { int main (int argc, char * argv[]) {
/*PIKbdListener k; /*PIKbdListener k;
k.enableExitCapture(); k.enableExitCapture();
@@ -12,7 +16,11 @@ int main (int argc, char * argv[]) {
k.start(); k.start();
WAIT_FOR_EXIT WAIT_FOR_EXIT
return 0;*/ return 0;*/
PIConfig c("mems.conf", PIIODevice::ReadOnly); /*PIConfig c("mems.conf", PIIODevice::ReadOnly);
piCout << c.allTree(); piCout << c.allTree();*/
PIKbdListener k(ke);
k.enableExitCapture();
k.start();
WAIT_FOR_EXIT
} }

View File

@@ -207,12 +207,22 @@ bool _PITimerImp_Thread::threadFunc() {
void _PITimerImp_Thread::adjustTimes() { void _PITimerImp_Thread::adjustTimes() {
PISystemTime cst = PISystemTime::current(true); PISystemTime cst = PISystemTime::current(true);
if (st_time < cst) { if (st_time < cst) {
while (st_time < cst) int rs = (cst - st_time).toSeconds() / st_inc.toSeconds();
st_time += st_inc; if (rs >= 100)
st_time = cst + st_inc;
else {
while (st_time < cst)
st_time += st_inc;
}
} else { } else {
cst += st_inc; int rs = (st_time - cst).toSeconds() / st_inc.toSeconds();
while (st_time > cst) if (rs >= 100)
st_time -= st_inc; st_time = cst - st_inc;
else {
cst += st_inc;
while (st_time > cst)
st_time -= st_inc;
}
} }
} }