Author image Tobias Bossert
and 1 contributors

NAME

A small collection of utility functions to convert machine-readable out to human friendly

METHODS

bits2human($n_bits)

Takes a number of bits and coverts it to a human readable amount of MiB

Parameters

  • $n_bits A number of bits

Returns

$n_bits * 1_000_000 . "MiB"

timestamp2human($timestamp)

Takes a unix timestamp and puts it in a human relatable form (delta from now)

Parameters

  • $timestamp Int or string containing a unix timestamp

Returns

A string describing how long ago this timestamp was

return_self($x)

The famous id() function

Parameters

  • $x Some value or object

Returns

$x