Beispiel #1
0
 /**
  * @test
  */
 public function it_formats_a_date_period()
 {
     // Single day
     $from = new DateTime('2015-1-1 00:00:00');
     $to = new DateTime('2015-1-1 05:00:00');
     $this->assertEquals('1st January 2015 12am – 5am', format_period($from, $to));
     $from = new DateTime('2015-1-1 00:35:00');
     $to = new DateTime('2015-1-1 05:50:00');
     $this->assertEquals('1st January 2015 12:35am – 5:50am', format_period($from, $to));
     $from = new DateTime('2015-1-1 19:30:00');
     $to = new DateTime('2015-1-2 03:30:00');
     $this->assertEquals('1st January 2015 7:30pm – 3:30am', format_period($from, $to));
     // Several Years
     $from = new DateTime('2000-1-1 00:00:00');
     $to = new DateTime('2015-1-1 00:00:00');
     $this->assertEquals('1st January 2000 – 1st January 2015', format_period($from, $to));
     $this->assertEquals('1st January 2000 12am – 1st January 2015 12am', format_period($from, $to, true));
     // Several Months
     $from = new DateTime('2015-1-1 00:00:00');
     $to = new DateTime('2015-2-1 00:00:00');
     $this->assertEquals('1st January – 1st February 2015', format_period($from, $to));
     $this->assertEquals('1st January 12am – 1st February 2015 12am', format_period($from, $to, true));
     // Single Month
     $from = new DateTime('2015-1-1 00:00:00');
     $to = new DateTime('2015-1-5 00:00:00');
     $this->assertEquals('1st – 5th January 2015', format_period($from, $to));
     $this->assertEquals('1st January 12am – 5th January 2015 12am', format_period($from, $to, true));
     $from = new DateTime('2016-02-13 17:33:00.000000');
     $to = new DateTime('2016-02-22 04:59:00.000000');
     $this->assertEquals('13th February 5:33pm – 22nd February 2016 4:59am', format_period($from, $to, true));
 }
    $p = 0;
    $a = $numeros[$p];
    $b = $numeros[$p + 1];
    $c = $numeros[$p + 2];
    $d = $numeros[$p + 3];
    $e = $numeros[$p + 4];
    $f = $numeros[$p + 5];
    $g = $numeros[$p + 6];
    $h = $numeros[$p + 7];
    $i = $numeros[$p + 8];
    $total = 2 * $c + 2 * $e + 2 * $g + $a + $b + $d + $f + $h + $i;
    if ($total == 52 && $a + $b + $c == 13 && $c + $d + $e == 13 && $e + $f + $g == 13 && $g + $h + $i == 13) {
        $result1 = "--Begin encontrado--\n";
        $result1 .= "A={$a}, B={$b}, C={$c}, D={$d}, E={$e}, F={$f}, G={$g}, H={$h}, I={$i}\n";
        $result1 .= '2 * $c + 2 * $e + 2 * $g + $a + $b + $d + $f + $h + $i' . "\n";
        $result1 .= "2 * {$c} + 2 * {$e} + 2 * {$g} + {$a} + {$b} + {$d} + {$f} + {$h} + {$i}" . "\n";
        $result1 .= "--End encontrado--\n";
        $result .= $result1;
        echo $result1;
        //$r =false;
    }
    //
    $n1++;
    //$count++; if($count==10000) $r =false;
    if ($n1 > 999999999) {
        $r = false;
    }
    $resta = microtime(true) - $tiempo_ini;
    echo $n1 - 1 . ' - total:' . $total . ' - ' . format_period($resta), "\n";
}
echo $result;
Beispiel #3
0
function initRoutes()
{
    $time_pre = microtime(true);
    // Populate the routes DB
    populateRoutes();
    // Select Driver
    insertDriver(0, 0);
    $time_post = microtime(true);
    $exec_time = $time_post - $time_pre;
    echo "New Schedules as Been Created: " . format_period($exec_time) . "</br>";
}