Page MenuHomePhabricator

Implement a basic `phutil_units()` function for writing "30 days in seconds" readably
ClosedPublic

Authored by epriestley on Feb 1 2014, 11:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 17 2026, 5:19 PM
Unknown Object (File)
Jan 11 2026, 5:41 AM
Unknown Object (File)
Dec 29 2025, 2:51 PM
Unknown Object (File)
Nov 27 2025, 6:38 AM
Unknown Object (File)
Oct 30 2025, 3:05 PM
Unknown Object (File)
Oct 21 2025, 9:41 PM
Unknown Object (File)
Oct 2 2025, 1:11 PM
Unknown Object (File)
Jun 9 2025, 1:54 AM
Subscribers

Details

Summary

Fixes T4325. We have a fair amount of (60 * 60 * 24 * 15) // 15 days stuff in the codebase, and at least one of them was wrong (15 hours, when 15 minutes was probably intended). I was about to write some more, so I wrote this instead.

Make these self-documenting and harder to get wrong.

(This function could be more sophisticated, but I think this is the only real use case we hit.)

Test Plan

Added and ran unit tests.

Diff Detail

Repository
rPHU libphutil
Branch
punits
Lint
Lint Passed
Unit
Tests Passed