<?php

function fn_seconds_l($aql)
{
	$data = $aql->Consume(1);
	$frame = $data[0]->value;
	
	$ttl = 0;
	foreach($frame as $itm)
	{		
		$st = new DateTime(str_replace(" ","T",$itm['from']));
		$en = new DateTime(str_replace(" ","T",$itm['to']));

		//print_r($en);
		$diff = $en->diff($st);
		$ttl += $diff->s + ($diff->i * 60) + ($diff->h * 3600) + ($diff->d * 86400);
	}
	
	$a = new AQLStackElement();
	$a->typename = "const";
	$a->islist = false;
	$a->value = $ttl;
	array_push($aql->stack,$a);
}
?>