There are two clocks on your system, the hardware clock (run by the CMOS battery when the system is turned off) and the system clock (which is software run by kernel interrupts).
Typically, the system clock is set by the hardware clock at boot and, on system shutdown, the system clock time is written to the hardware clock.
Also typically, the system clock is kept synchronized by Network Time Protocol (NTP), a daemon that is started during boot (after the system clock is set). NTP synchronizes with either an external time server, referenced back to an so-called "atomic clock" or to a hardware clock on your LAN that uses GPS or radio clock signals (such as, in the US and Canada) WWV. If you're using NTP, you define three Internet pool time servers which NTP evaluates and determines the quality of the servers and chooses the best one (every so often NTP re-evaluates and may throw out one, two or all three pool servers and selects more from the available pool servers, evaluates the best of those and synchronizes to it.
The pool servers are defined in
/etc/ntp.conf like this:
Code:
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
You do not want to specify one of the "atomic" clock servers, that's a no-no.
You also define a "fudge" server, actually you own system clock, to synchronize itself to when there is no Internet available (we had heavy wet snow last night, my satellite dish was covered with it, no signal until I went out and brushed it off and the Internet became available again -- NTP synchronized to the system clock and, when the 'Net came back, it synchronized with the external time serves).
A "fudge" server is defined like this:
Code:
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
That permits the fall-back when there is no external synchronization available.
You can set your hardware clock to local time, you can also set it to UTC: you are encouraged to set the hardware clock to UTC and set your system clock to your local time zone. Software controls the switch to and from daylight savings time, summer time or whatever it's called where your system lives. The switch dates are known, they're in your system software and you don't have to fiddle with anything.
So, what's kernel time? It's system time, kept synchronized by NTP.
NTP does a great job of keeping everything on time and running smoothly.
So, for your purposes, simply use the time and date utilities (or system calls) to get the current time accurately (if you're using NTP, that is -- otherwise things wander all over the place). What NTP does is nudge your system time into accuracy by slowly (like over a week or two or three) adjusting the value stored in
/etc/ntp/drif (that changes the longer NTP runs) to keep things pretty darned close (like a few milliseconds or so).
And, again, when you shut down the accurate system time is written to the hardware clock and when you boot, the system time is initially set from that and NTP takes over and synchronizes with an external time source and there you go.
Hope this helps some.