Ps-p {pid}-o etime how is the elapsed time of the process calculated?

ps-p 986-o etime can get the execution time of process 986, regardless of whether the system time has changed or not, it can return the correct result:

-bash-4.2$ ps -p 986 -o etime
    ELAPSED
13-00:25:12

the above shows that the 986 process has been running for 13 days, 25 minutes and 12 seconds.

it can be seen that it accumulates the real running time of the program, not the difference between the running time of the system and the start of the process (this is not accurate in other cases such as time Synchronize, which can cause changes in the time of the system).

I looked at / proc/986/stat, / proc/986/status and other system files, and found no corresponding process running time value. ps-p 986-o etime how is it implemented?

Mar.05,2021

is really calculated based on the difference between system run time and process startup .
the elapsed time of the system (see / proc/uptime for details) is based on how many seconds have elapsed since the system started (it is actually clock tick,), rather than the system time, so it will not be affected by the change of the system time;
similarly, the process startup time is also the number of seconds after the system startup.
the difference between the two gives the elapsed time of the process

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37864-2c098.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37864-2c098.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?