why can't I match jiffies to uptime?
What you're trying to do is how Linux used to work -- 10 years ago.
It's become more complicated since then. Some of the complications that I know of are:
- There's an offset of -5 minutes so that the kernel always tests jiffy rollover.
- The kernel command line can set a jiffy skip value so a 1000 Hz kernel can run at 250 or 100 or 10.
- Various attempts at NoHZ don't use a timer tick at all and rely only on the timer ring and the HPET.
- I believe there are some virtual guest extensions that disable the tick and ask the host hypervisor whenever a tick is needed. Such as the Xen or UML builds.
That's why the kernel has functions designed to tell you the time. Use them or figure out what they are doing and copy it.