timing - How to get a millisecond precision uptime from user-space in Linux? -


i'm working on raspberry pi based project has gps module boss wants me time system clock. need take readings on different sensors whilst gps may not have fix, , need know millisecond precision (tolerance of 50-100ms fine) when these readings taken.

personally want hardware rtc this, i've been instructed work around it. idea mark each reading relative time system boot, system time not reliable, , updated ntp/satellite time when available (i can fix-up records when synchronized time available using relative time).

so, how can millisecond precise uptime in linux user-space c code? jiffies value available in kernel perfect.

i think have check main controller(cpu) on board. usually, there hardware timer module integrated cpu, or decrementer register implementation in cpu core.

if there hardware timer or dec register on cpu, use implement periodical interrupt(the frequency can 1000hz or else). interrupt handler can notify/wakeup user-space process necessary real-time work.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -