function printMsec($time, $warn = 5, $error = 10) { $str = formatMsec($time); if (!class_exists('ColorCLI')) { return $str; } $msec = msec($time); if ($msec < $warn) { return ColorCLI::lightGreen($str); } elseif ($msec < $error) { return ColorCLI::yellow($str); } return ColorCLI::red($str); }
function setData($data) { $respuesta[recibido] = $data; $recibidos = count($data); $tiempo_inicio = msec_format(); $time_start = msec(); for ($i = 0; $i < $recibidos; $i++) { $respuestaArray[] = array(uno => 'Respondido - ' . $i, dos => 'Respondido - Segundo elemento', tres => array(fecha => date('Y-m-d'), hora => msec_format(), microtime => microtime(true) - $time_start), cuatro => 'Respondido - Cuarto elemento'); } $tiempo_fin = msec_format(); $time_transcurred = msec() - $time_start . ' segundos'; $respuesta[respuesta] = $respuestaArray; $respuesta[success] = array(array(ok => true, t_inicio => $tiempo_inicio, t_final => $tiempo_fin, segs_consumidos => $time_transcurred)); return $respuesta; }