clk: timestamps
Yann Droneaud
ydroneaud at opteya.com
Wed Jun 27 03:47:10 EDT 2018
Hi,
Le mardi 26 juin 2018 à 19:44 +0530, Subhashini Rao Beerisetty a
écrit :
>
> In the kernel code I see it supports CLOCK_REALTIME \ CLOCK_MONOTONIC
> \ CLOCK_MONOTONIC_RAW timestamps. Can someone explain what’s major
> difference between those three modes and when to use which one?
>
A generic answer could be found here:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
> I’ve N number of Linux machines in the network with the same software
> running. Basically I need to collect the timestamps in kernel mode in
> all the machines and then compare, which(either CLOCK_REALTIME or
> CLOCK_MONOTIC_RAW or MONOTONIC) one would be the correct way?
>
Probably none. Anyway, please find some hints below:
None of the monotonic clocks can be used because they're not supposed
to be synchronized accross the network
You're left with CLOCK_REALTIME, which is not synchronized accross the
network by default.
So before doing timestamp comparison, you would need to setup time
synchronisation between hosts on your network: NTP to synchronise hosts
to the same seconds with couple of millisecond precision, PTP for sub
millisecond precision.
Time synchronisation is a tough problem but it's required if you want
to be able to compare timestamp accross hosts in a network.
Regards.
--
Yann Droneaud
OPTEYA
More information about the Kernelnewbies
mailing list