' );
echo ( 'The time is now: '.date('Y M d H:i:s',$c->getTimestamp()).'
' );
$i = 1;
echo ( '
The first iteration is more "expensive", the calendar data structures having to be built.
' ); $start = getmicrotime(); $c->build(); while ( $e = $c->fetch() ) { $class = strtolower(get_class($e)); $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); $method = 'this'.str_replace('calendar_','',$class); echo ( "".$e->{$method}()." : " ); if ( ($i % 10) == 0 ) { echo ( 'Took: '.(getmicrotime()-$start).' seconds
' ); $i = 1; echo ( 'This second iteration is faster, the data structures being re-used
' ); $start = getmicrotime(); while ( $e = $c->fetch() ) { $class = strtolower(get_class($e)); $link ="&y=".$e->thisYear()."&m=".$e->thisMonth()."&d=".$e->thisDay(). "&h=".$e->thisHour()."&i=".$e->thisMinute()."&s=".$e->thisSecond(); $method = 'this'.str_replace('calendar_','',$class); echo ( "".$e->{$method}()." : " ); if ( ($i % 10) == 0 ) { echo ( 'Took: '.(getmicrotime()-$start).' seconds
' ); ?>