import time start = time.time() # Can go backwards if system clock is adjusted # ... work ... end = time.time()
1. Definition and Core Concept Wall time (also known as "real time," "elapsed real time," or "wall clock time") is the total time that elapses from the start of a process or event to its end, as measured by a clock on the wall (or, more precisely, by a standard timekeeping device like a wristwatch or system clock). It includes every possible delay, interruption, or idle period that occurs in the real world. wall time
| Language/Environment | Recommended API | Notes | |----------------------|----------------|-------| | | clock_gettime(CLOCK_MONOTONIC, &ts) | Monotonic clock unaffected by NTP adjustments | | Python | time.perf_counter() | High-resolution, monotonic, includes sleep time | | Java | System.nanoTime() | Monotonic, not System.currentTimeMillis() (which is wall-clock time that can jump) | | Go | time.Now() (combined with time.Since(start) ) | On most OSes, uses monotonic clock internally | | Command line (Unix) | time ./program | Reports real (wall) time | | Command line (Windows) | Measure-Command .\program.exe | PowerShell cmdlet | import time start = time
Unlike other time metrics that focus only on active work, wall time is the experienced by an observer standing by and watching a physical or digital clock. Definition and Core Concept Wall time (also known