#!/usr/bin/perl
use strict ;
use warnings ;
use Time::HiRes qw( gettimeofday tv_interval) ;
 
sub calcultime {
	my ($seconds, $microseconds) = gettimeofday;
	if( !ref($_[0]) ) {
		my $ref = [ ($seconds, $microseconds) ] ;
		return ($ref) ;
	}
	else {
		my ($oldtime, $name) = @_ ;
		my ($oldseconds, $oldmicroseconds) = @$oldtime ;
		my $elapsed = tv_interval( [$oldseconds, $oldmicroseconds, [$seconds, $microseconds]] );
		return($elapsed);
	}
}