Mercurial > MadButterfly
comparison src/timertool.c @ 107:069868161f63
Fix bug of get_now()
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 12 Sep 2008 12:55:13 +0800 |
parents | 3f619ae03678 |
children | 5df7403b6fbc |
comparison
equal
deleted
inserted
replaced
106:74e2ffd50741 | 107:069868161f63 |
---|---|
35 MB_TIMEVAL_SET(tmo, tv.tv_sec, tv.tv_usec); | 35 MB_TIMEVAL_SET(tmo, tv.tv_sec, tv.tv_usec); |
36 MB_TIMEVAL_CP(&tm, tmo); | 36 MB_TIMEVAL_CP(&tm, tmo); |
37 diff = 0; | 37 diff = 0; |
38 } else { | 38 } else { |
39 ts = rdtsc(); | 39 ts = rdtsc(); |
40 diff += ts - last_ts; | 40 diff = ts - last_ts; |
41 sdiff = diff / cpufreq; | 41 sdiff = diff / cpufreq; |
42 udiff = (diff % cpufreq) * 1000000 / cpufreq; | 42 udiff = (diff % cpufreq) * 1000000 / cpufreq; |
43 | 43 |
44 MB_TIMEVAL_SET(&diff_tm, sdiff, udiff); | 44 MB_TIMEVAL_SET(&diff_tm, sdiff, udiff); |
45 MB_TIMEVAL_CP(tmo, &tm); | 45 MB_TIMEVAL_CP(tmo, &tm); |