Source code for repomatic.humanize
# Copyright Kevin Deldycke <[email protected]> and contributors.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""Human-readable renderings of raw file-system quantities.
Byte counts and modification times reach the user through more than one surface
(the image-optimization summary, the `repomatic cache` tables), and each surface
should spell them the same way. One home for those conversions keeps the wording
consistent and keeps the formatters out of the modules that merely happen to be
the first consumer.
Dependency-free beyond `click_extra`, so any module can import it without
risking a cycle.
"""
from __future__ import annotations
import time
from click_extra import format_size
SECONDS_PER_DAY = 86400
"""Divisor turning an mtime delta into whole days."""