Python Timer Functions: An Overview @realpython
Python Timer Functions: An Overview  @realpython
Uploaded September 2026 | Updated December 2026, 2 days ago
Continue here β†’ realpython.com/courses/python-timer-functions/?utm_source=youtube&utm_medium=description&utm_campaign=python-timer-functions&utm_content=QQggEofGdss

Download your free Python Cheat Sheet here: realpython.com/cheatsheet?utm_source=youtube&utm_medium=description&utm_campaign=cheatsheet&utm_content=QQggEofGdss
Free Python Skill Test with instant level + learning plan: realpython.com/skill-test?utm_source=youtube&utm_medium=description&utm_campaign=skill-test&utm_content=QQggEofGdss
Want to learn faster? Become a Python Expert with unlimited access to 5,000+ tutorials, videos, and exercises: realpython.com/start?utm_source=youtube&utm_medium=description&utm_campaign=start&utm_content=QQggEofGdss

Python's time module gives you four different ways to measure time β€” monotonic(), perf_counter(), process_time(), and time() β€” and they don't all agree with each other. One ignores your system clock. One ignores sleep() entirely. One can run backwards.

In six minutes, Mahdi Shadkam-Farrokhi walks through all four with live demos, including winding the system clock back an hour mid-measurement to show which functions notice and which don't. By the end you'll know which function belongs in a timeout, which belongs in a benchmark, which belongs in a profiler, and which belongs in a log line.

Then take it further: the full video course abstracts these functions into a reusable Timer class, extends it to handle multiple timers, turns it into a data class, and finally makes it work as a context manager.

πŸ‘‰ Links from the video:
Python Timer Functions (video course): realpython.com/courses/python-timer-functions/?utm_source=youtube&utm_medium=description&utm_campaign=python-timer-functions&utm_content=QQggEofGdss
Python Timer Functions: Three Ways to Monitor Your Code: realpython.com/python-timer/?utm_source=youtube&utm_medium=description&utm_campaign=python-timer&utm_content=QQggEofGdss
The time module reference: realpython.com/ref/stdlib/time/?utm_source=youtube&utm_medium=description&utm_campaign=time&utm_content=QQggEofGdss

00:00 A riddle about time
00:18 All you need is import time
00:55 Which timer function when?
01:05 The four functions
01:12 monotonic() and monotonic_ns()
02:02 Demo: monotonic ignores the system clock
02:29 perf_counter() for benchmarking
02:51 process_time() counts CPU time only
03:21 Demo: sleep() and input() cost no CPU time
03:53 time() and the epoch
04:36 Why time() is the one for logging
04:58 Demo: time() running backwards
05:10 Building a Timer class
05:15 What the full course covers

🐍 Become a Python expert with real-world tutorials, on-demand courses, interactive quizzes, and 24/7 access to a community of experts at https://realpython.com?utm_source=youtube&utm_medium=description&utm_campaign=home&utm_content=QQggEofGdss

β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°
🐍 Start Here β†’ realpython.com/start?utm_source=youtube&utm_medium=description&utm_campaign=start&utm_content=QQggEofGdss
πŸ—ΊοΈ Guided Learning Paths β†’ realpython.com/learning-paths/?utm_source=youtube&utm_medium=description&utm_campaign=learning-paths&utm_content=QQggEofGdss
🎧 Real Python Podcast β†’ realpython.com/podcast?utm_source=youtube&utm_medium=description&utm_campaign=podcast&utm_content=QQggEofGdss

πŸ“š Python Books β†’ realpython.com/books?utm_source=youtube&utm_medium=description&utm_campaign=books&utm_content=QQggEofGdss
πŸ“– Python Reference β†’ realpython.com/ref?utm_source=youtube&utm_medium=description&utm_campaign=ref&utm_content=QQggEofGdss
πŸ§‘β€πŸ’» Quizzes & Exercises β†’ realpython.com/quizzes/?utm_source=youtube&utm_medium=description&utm_campaign=quizzes&utm_content=QQggEofGdss

πŸŽ“ Live Courses: realpython.com/live/?utm_source=youtube&utm_medium=description&utm_campaign=live&utm_content=QQggEofGdss
⭐️ Reviews & Learner Stories: realpython.com/learner-stories/?utm_source=youtube&utm_medium=description&utm_campaign=learner-stories&utm_content=QQggEofGdss
β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°β–°
Python Timer Functions: An OverviewParquet Is 27 Times Faster Than CSVDjango Developers Survey Results & Reproducible Python Builds | Real Python Podcast #311New @ Syntax Could Replace AnnotatedSo Many Companies Still Skip Automated TestingCDN vs Local JavaScriptBig Model vs Big Harness: The AI Agent DebateReduce Project Risk by Testing Your Linchpins FirstLessons From the AI WinterThis AI Mentor Guides Your Python Journey3 Claude Code Skills to Make Sense of AI CodeClean Code vs Technical Debt!
Real Python |

Python Timer Functions: An Overview

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER