How to Determine Wall Clock Time of a Process

time

I have found the general Linux program time, which times a command. For example, suppose I want to time the execution of foo. I can use:

time foo

which gives this sample output:

real    0m8.738s
user    0m5.796s
sys     0m0.576s

However, the man page for time seems a bit unclear (although I am a Linux novice):

TIME(1)                       Linux User's Manual                      TIME(1)



NAME
       time - time a simple command or give resource usage

SYNOPSIS
       time [options] command [arguments...]

DESCRIPTION
       The  time  command  runs  the  specified program command with the given
       arguments.  When command finishes, time writes a  message  to  standard
       error  giving  timing statistics about this program run.  These statis-
       tics consist of (i) the elapsed real time between invocation and termi-
       nation, (ii) the user CPU time (the sum of the tms_utime and tms_cutime
       values in a struct tms as returned by times(2)), and (iii)  the  system
       CPU  time  (the  sum of the tms_stime and tms_cstime values in a struct
       tms as returned by times(2)).

Does the "real" time refer to the wall clock time?

Best Answer

"Real" time is elapsed time, which is usually the difference between wall clock times, but not always.

For example, if you start a process at 01:59:00 on the day in which daylight-savings (summer) time takes effect in a locale in which the time change is at 02:00, and the process takes two minutes, then the real elapsed time will be two minutes, while the wall clock will show a difference of one hour and two minutes. (When the time offset changes back, the wall clock difference will be negative, but the real elapsed time will continue to be the same.)

Related Question