Net::DNS::SEC::Tools::timetrans.3pm

Langue: en

Version: 2010-06-25 (ubuntu - 24/10/10)

Section: 3 (Bibliothèques de fonctions)

NAME

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

SYNOPSIS

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

DESCRIPTION

The timetrans() interface in Net::DNS::SEC::Tools::timetrans converts an integer seconds count into the equivalent number of weeks, days, hours, and minutes. The time converted is a relative time, not an absolute time. The returned time is given in terms of weeks, 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.

INTERFACES

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 weeks, 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.
 
 

EXAMPLES

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 1 week, 1 day, 6 hours, 36 minutes, 40 second

timetrans(720000) returns 1 week, 1 day, 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-2010 SPARTA, Inc. All rights reserved. See the COPYING file included with the DNSSEC-Tools package for details.

AUTHOR

Wayne Morrison, tewok@users.sourceforge.net

SEE ALSO

timetrans(1)