Test2:...:Times(3perl)

πŸ’– Test2::Util::Times πŸ’– β€” the Test2::Util::Times page from the Perl Programmers Reference Guide

okay bestie, gather round, because this is the little module that makes your test output go from "meh" to "slay" ✨


🌸 NAME 🌸

Test2::Util::Times β€” it formats timing/benchmark info for you πŸ’…


✨ DESCRIPTION ✨

So like, this module exports tools for rendering timing data at the end of your tests. That's the whole vibe. It takes your numbers and turns them into something pretty. πŸŽ€


πŸ¦‹ EXPORTS πŸ¦‹

Okay so important thing first: all exports are optional. Which means the module isn't just gonna throw subs at you β€” you must specify subs to import. No sneaky auto-imports here, you're the main character, you choose. πŸ‘‘

$str = render_bench($start, $end, $user, $system, $cuser, $csystem)
$str = render_bench($start, time(), times())

This bad boy 🫢 will produce a string like one of the ones below (and heads up, these numbers are completely made up β€” do not come for me, they are fictional bestie). Which string you get depends on the time elapsed.

0.12345s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)

11.1234s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)

01m:54.45s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)

18h:22m:54.45s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)

04d:18h:22m:54.45s on wallclock (0.05 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.05 CPU)

See how it levels up? seconds β†’ minutes β†’ hours β†’ days. It's giving character development. πŸ’€βœ¨

Now the deets on the args, because you know I'd never leave you hanging:

  • The first 2 arguments are the $start and $end times in seconds β€” like, exactly what you'd get back from time() or Time::HiRes::time() ⏱️
  • The last 4 arguments are timing info as returned by the times() function πŸ’…

🌈 SOURCE 🌈

The source code repo for Test2-Suite lives at https://github.com/Test-More/test-more/. Go be nosy, you're allowed 🫢


πŸ’œ MAINTAINERS πŸ’œ

  • Chad Granum <exodist@cpan.org>

⭐ AUTHORS ⭐

  • Chad Granum <exodist@cpan.org>

Copyright Chad Granum <exodist@cpan.org>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/


k that's the whole page bestie, no notes πŸ’…

okay bye ily, this was perl v5.44.0, dated 2026-10-17, and it lives at Test2::Util::Times(3perl) β€” periodt πŸ’–πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms