Portál AbcLinuxu, 16. dubna 2024 18:32
#include stdio.h #include sys/time.h int main(void){ struct timeval tv; struct timezone tz; suseconds_t usec; suseconds_t expect = 0; suseconds_t delta = 200000; suseconds_t expect_new = delta; while (1){ gettimeofday(&tv, &tz); usec = tv.tv_usec; if ((usec menšíneborovno expect) && (usec menšínež expect_new)){ printf("%d\n", usec); expect = expect_new % 1000000; expect_new = expect + delta; } } return 0; }Měl by vypsat číslo každých 200ms (aby to nebylo moc rychle). Bude tam vidět i odchylka, k jaké došlo. Je to celkem zajímavá podívaná, zvlášť když se to pustí s nice -n -19
Tiskni Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.