timeutil

package
v0.16.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package timeutil provides time formatting utilities for human-readable duration display.

Durations are formatted as "Xm Ys" for durations of one minute or more, and "Ys" for shorter durations. The value is rounded to the nearest second.

Examples:

timeutil.FormatDuration(83 * time.Second)  // "1m 23s"
timeutil.FormatDuration(45 * time.Second)  // "45s"
timeutil.FormatDuration(8 * time.Hour)     // "480m 0s"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDuration

func FormatDuration(d time.Duration) string

FormatDuration formats a duration into a human-readable string. It rounds to the nearest second and displays in "Xm Ys" or "Ys" format.

Examples:

  • 1m 23s for durations >= 1 minute
  • 45s for durations < 1 minute
  • 480m 0s for 8-hour duration (no hour formatting)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL