On Tue, 15 Apr 2025 at 19:48, Paul Szabo <paul.sz...@sydney.edu.au> wrote:

>
> psz@azaona:~$ date --rfc-3339=ns; ps -ouser,lstart,command | grep -E
> 'psz.*grep|USER'
> 2025-04-15 19:38:41.589754682+10:00
> USER                      STARTED COMMAND
> psz      Tue Apr 15 19:38:40 2025 grep -E psz.*grep|USER
>
> Surely worth re-opening, and fixing anytime in the next 20 years?
>
I've had another look at this, I've been looking at the angle from start
time to boot time, but that might not be where the issue is.

lstart comes from boot_time + TICS_BEGAN which is then converted to a real
time with localtime and strftime
boot_time comes from the btime field in /proc/stat
TICS_BEGAN comes from field 22 of /proc/PID/stat (converted from Hz, or
divided by 100).

So, could btime be wrong? Or rather be correct at time of boot and then the
system (once network is up and ntp is online) change its systen time?
$ date +%s ; btime=`grep btime /proc/stat |cut -f 2 -d' '` ; utime=`cut -f
1 -d'.' /proc/uptime` ; date +%s ; now=$((utime + btime)) ; echo $now
1744714188
1744714188
1744714187

 - Craig

Reply via email to