timetrans(3) User Contributed Perl Documentation timetrans(3)

Net::DNS::SEC::Tools::timetrans - Convert an integer seconds count into text units.

use Net::DNS::SEC::Tools::timetrans;
$timestring = timetrans(86488);
$timestring = fuzzytimetrans(86488);

The timetrans() interface in Net::DNS::SEC::Tools::timetrans converts an integer seconds count into the equivalent number of days, hours, and minutes. The time converted is a relative time, not an absolute time. The returned time is given in terms of days, hours, minutes, and seconds, as required to express the seconds count appropriately.

The fuzzytimetrans() interface converts an integer seconds count into the equivalent number of weeks or days or hours or minutes. The unit chosen is that which is most natural for the seconds count. One decimal place of precision is included in the result.

The interfaces to the Net::DNS::SEC::Tools::timetrans module are given below.

timetrans()

This routine converts an integer seconds count into the equivalent number of days, hours, and minutes. This converted seconds count is returned as a text string. The seconds count must be greater than zero or an error will be returned.

Return Values:

If a valid seconds count was given, the count converted into the
    appropriate text string will be returned.
An empty string is returned if no seconds count was given or if
    the seconds count is less than one.

fuzzytimetrans()

This routine converts an integer seconds count into the equivalent number of weeks, days, hours, or minutes. This converted seconds count is returned as a text string. The seconds count must be greater than zero or an error will be returned.

Return Values:

If a valid seconds count was given, the count converted into the
    appropriate text string will be returned.
An empty string is returned if no seconds count was given or if
    the seconds count is less than one.

timetrans(400) returns 6 minutes, 40 seconds

timetrans(420) returns 7 minutes

timetrans(888) returns 14 minutes, 48 seconds

timetrans(86400) returns 1 day

timetrans(86488) returns 1 day, 28 seconds

timetrans(715000) returns 8 days, 6 hours, 36 minutes, 40 second

timetrans(720000) returns 8 days, 8 hours

fuzzytimetrans(400) returns 6.7 minutes

fuzzytimetrans(420) returns 7.0 minutes

fuzzytimetrans(888) returns 14.8 minutes

fuzzytimetrans(86400) returns 1.0 day

fuzzytimetrans(86488) returns 1.0 day

fuzzytimetrans(715000) returns 1.2 weeks

fuzzytimetrans(720000) returns 1.2 weeks

Copyright 2004-2014 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details.

Wayne Morrison, tewok@tislabs.com

timetrans(1)

2023-07-29 perl v5.38.0