App-Prefix

 view release on metacpan or  search on metacpan

bin/prefix  view on Meta::CPAN

    my $t = shift || time();
    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($t);
    #return sprintf("%04d-%02d-%02d %02d:%02d:%02d", 1900+$year, $mon+1, $mday, $hour, $min, $sec);
    return POSIX::strftime( "%Y-%m-%d %H:%M:%S", $sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
}

############################################
# converts seconds to human-readable.
# I couldn't find a module on cpan that did (exactly) this :)
# the criteria is a short string describing the time duration, that's easy to parse.
# (DateTime::Format::Human::Duration is similar, but won't show fractional durations like "1.2 mins"
sub seconds_for_display {
    my $t = shift;
    my $precision = shift || 2;
    my $format = '%1.' . ${precision} . "f";

    if ($raw) { 
        if (int($t) == $t) {
            return "$t secs";
        } else {
            return sprintf( $format, $t ) . " secs";



( run in 0.243 second using v1.01-cache-2.11-cpan-496ff517765 )