HR(3pm)

πŸ’– NAME πŸ’–

Time::HR β€” bestie, it's a Perl interface to a high-resolution timer. That's the whole vibe. ✨

🌸 SYNOPSIS 🌸

use Time::HR;

$hrtime  = gethrtime();

That's it. That's the entire API. So clean, so minimal, we love a low-maintenance icon. πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so Time::HR is a very simple interface to the high-resolution timer β€” like, it literally only supports one function call, and that function is gethrtime(). One function. Main character energy, honestly. πŸ‘‘

The gethrtime() function hands you back the current high-resolution real time value, and it comes to you either as a 64-bit integer (on systems with 64-bit support, obviously, slay) or as a double value. Wherever your platform lands, that's what you get. 🌈

And the number it gives you? It's expressed as nanoseconds since some arbitrary time in the past. Note that: arbitrary. It is not correlated in any way to the time of day, so do NOT treat it like a clock, bestie, I'm begging. Because of that it is also not subject to resetting or drifting by way of adjtime or settimeofday. It just vibes, monotonic and unbothered, immune to whatever the system clock is going through. πŸ§˜β€β™€οΈ

The high resolution timer is ideally suited to performance measurement tasks, aka the situations where you need cheap, accurate interval timing. Benchmarks, profiling, measuring how long that one cursed function takes β€” that's the moment. ⏱️πŸ”₯

πŸ’€ Real talk though: currently, this extension is only supported on Solaris, Linux and Cygwin. If you're on something else, the vibe check has failed. Sorry bestie. 😭

πŸŽ€ EXPORT

gethrtime

Yep, gethrtime is what gets exported. It's the one and only. She doesn't share the spotlight. ✨

🫢 Exportable constants

none

(as in, nada, zero, nothing β€” not a single constant to export. The icon travels light. πŸ’–)

πŸ‘‘ AUTHOR πŸ‘‘

Alexander Golomshtok, golomshtok_alexander@jpmorgan.com

Shoutout to the author, fr fr. 🫢

🌟 SEE ALSO 🌟

  • perl.

like, just perl. The mothership. Go read it, iykyk. πŸͺ


and that's the whole page, bestie!! πŸŽ€ this was perl v5.42.3, dated 2026-08-19, and you just read HR(3pm) from the User Contributed Perl Documentation. go forth and time things accurately. mwah. πŸ’œβœ¨

πŸ“¦ where this page comes from