NAME

DynGig::Util::Time - Interpret time expressions

METHODS

delta_epoch( epoch => time, delta => delta )

Returns seconds since epoch.

my $time = DynGig::Util::Time->delta_epoch
(
    epoch => seconds,
    delta => '3days,4weeks,-3hours,+4seconds'
);

epoch( time, timezone )

Returns seconds since epoch.

$time = DynGig::Util::Time->epoch( '-23459271.03' );
$time = DynGig::Util::Time->epoch( '3days,4weeks,-3hours,+4seconds' );

$time = DynGig::Util::Time->epoch( '2010-03-12', 'UTC' );
$time = DynGig::Util::Time->epoch( '2010-03-12 00:12:24' );

$time = DynGig::Util::Time->epoch( '09:12:42' );
$time = DynGig::Util::Time->epoch( '09:12', 'America/Los_Angeles' );

abs2sec( time, timezone )

Alias of epoch().

rel2sec( expression )

Given a relative time expression, returns seconds.

$sec = DynGig::Util::Time->rel2sec( '3minutes,-4weeks,+4seconds' );

sec2hms( seconds )

Given seconds, returns a HH::MM::SS string.

$hms = DynGig::Util::Time->sec2hms( 37861 );

hms2sec( string )

Given a HH::MM::SS string, returns seconds.

$sec = DynGig::Util::Time->hms2sec( '40:23:26' ); ## hour:min:sec
$sec = DynGig::Util::Time->hms2sec( '23:26' );    ## min:sec
$sec = DynGig::Util::Time->hms2sec( '26' );       ## sec

NOTE

See DynGig::Util