The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Siebel::Srvrmgr::ListParser::Output::Duration - Moose role to deal with start and end time of objects

SYNOPSIS

    with 'Siebel::Srvrmgr::ListParser::Output::Duration';

DESCRIPTION

This Moose role enables a class to deal with start and end time of it's instances, including calculating the duration of the object life inside the Siebel Server.

ATTRIBUTES

start_datetime

A string representing the date and time the object was created.

The string will have the following format:

    YYYY-MM-DD hh:mm:ss

This is a required attribute duration object creation and it's read-only.

curr_datetime

A DateTime instance created during the object creation that is using this role.

In the absence of a value for end_time attribute, this object will be used to calcule the value returned by duration method.

This is a read-only attribute.

end_datetime

Same thing as start_time, but representing when the object had finish anything that was doing in the Siebel server.

It is not a required attribute during creation and it is read-only. The default value for it is an empty string.

time_zone

The time_zone to be considered for the time stamps parsed, for having proper date and time as configured in the Siebel Enterprise OS level.

This parameter has a default value fetched from the environment variable c<SIEBEL_TZ>, so this variable must previously set before to avoid errors. See Siebel::Srvrmgr::Daemon for that.

METHODS

get_time_zone

Returns the time_zone attribute value.

get_start

Returns start_datetime attribute value.

get_current

Returns curr_datetime attribute value.

get_end

Returns end_datetime attribute value.

fix_endtime

This method will check the value of end_time attribute for inconsistences and set a sane value to it.

Any class using this role must execute this method inside it's BUILD method. If there isn't one, you will need to a create one to do that.

is_running

This method checks if the object is still (supposely) running by the time it's data was recovered from srvrmgr.

If returns true (1) or false (0);

get_datetime

Expects as parameter a string in the format of start_datetime attribute.

Returns a DateTime object representation of this string using the available timezone and locale information.

get_duration

Calculates how much time the object spent doing whatever it was doing, or, if it is not finished, how much time already spent doing that (using curr_datetime attribute for that).

The return value is in seconds.

SEE ALSO

AUTHOR

Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>.

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 of Alceu Rodrigues de Freitas Junior, <arfreitas@cpan.org>.

This file is part of Siebel Monitoring Tools.

Siebel Monitoring Tools is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Siebel Monitoring Tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Siebel Monitoring Tools. If not, see http://www.gnu.org/licenses/.