My system is running Linux for embedded. At the moment I didn't sync the system clock or gave the user an option to do it but it's going to change.
Different parts in my application are using timestamps, I want to use different clock then the system clock for this timestamps so they will not get affected when the system time is change by ntp/user. I know that the system has the uptime value so it's keeping track on a different clock beside the system clock, but the precision of the uptime is too low (seconds)...
Is there a way to get the uptime with better precision (milliseconds)?
答案1
/proc/uptime
gives the uptime in hundredths of a second.
If you want more precise values, you could write a kernel module based on the /proc/uptime
implementation.