handle time on linux

This commit is contained in:
Zane C. B-H 2019-08-26 20:52:11 -05:00
parent 243eaced76
commit 256af82bbc
3 changed files with 13 additions and 5 deletions

View File

@ -1,5 +1,9 @@
Revision history for Proc-ProcessTable-Match Revision history for Proc-ProcessTable-Match
0.0.1 2019-08-26/20:45
- Handle time properly on linux now
by converting it to seconds.
0.0.0 2019-08-25/06:00 0.0.0 2019-08-25/06:00
- Initial release. - Initial release.

View File

@ -10,11 +10,11 @@ Proc::ProcessTable::Match - Matches a Proc::ProcessTable::Process against a stac
=head1 VERSION =head1 VERSION
Version 0.0.0 Version 0.0.1
=cut =cut
our $VERSION = '0.0.0'; our $VERSION = '0.0.1';
=head1 SYNOPSIS =head1 SYNOPSIS

View File

@ -10,11 +10,11 @@ Proc::ProcessTable::Match::Time - Check if the user + system time of a process m
=head1 VERSION =head1 VERSION
Version 0.0.0 Version 0.0.1
=cut =cut
our $VERSION = '0.0.0'; our $VERSION = '0.0.1';
=head1 SYNOPSIS =head1 SYNOPSIS
@ -41,7 +41,7 @@ our $VERSION = '0.0.0';
This intiates the object. This intiates the object.
It takes a hash reference with one key. One key is required and It takes a hash reference with one key. One key is required and
that is 'times', which is a array of time values to match. that is 'times', which is a array of time values in seconds to match.
The Time values can be prefixed with the equalities below for doing The Time values can be prefixed with the equalities below for doing
additional comparisons. additional comparisons.
@ -129,6 +129,10 @@ sub match{
return 0; return 0;
} }
if ( $^O =~ /^linux$/ ){
$proc_time=$proc_time/1000000;
}
# use while as foreach will reference the value # use while as foreach will reference the value
my $time_int=0; my $time_int=0;
while (defined( $self->{times}[$time_int] )){ while (defined( $self->{times}[$time_int] )){