I leettime twitter ile buldum ve beni sizlerle paylaşmak / onunla etrafında karışıklık istediğiniz için yeterli roman. Benim dehşet bu sürümü saniye yapmaz. Süresi oluşturmak için daha etkili bir yolu olabilir gibi de görünüyor, sen ne düşünüyorsun?
Leet Time
Now, how is this leettime calculated?
For a given humantime (e.g. 11:15 am) the value of the leettime corresponds to the number of times you have to add up 13 hours 37 minutes in order to exactly reach this time. Whenever the result overflows during the calculation (i.e. the obtained time exceeds 23:59 o'clock) you subtract 24 hours in order to stay on the clock.
Example:
The leettime of 00:00 is 0, the leettime of 13:37 is 1 and leettime 2 corresponds to 03:14 am (because 13:37 plus 13 hours 37 minutes is 03:14 o'clock).
Is there a unique leettime for every humantime during the day?
Yes! There are exactly 24*60=1440 different leettimes, each corresponds to exactly one minute in the day.
Serin olacağını düşünüyorum başka ne eklemek, ben bu adam bunu isterdim eminim.
Ben en çok erişilebilir ve taşınabilir olurdu sergiyi PHP versiyonunu koydu. The other versions are available here. a>
<?php
/**
* Converts standard time to leettime.
*
* @param int h the hour in standard time
* @param int m the minute in standard time
*
* @return int the leettime or -1 if the input
* parameters are invalid
*/
function TimeToLeet($h, $m){
if(!is_numeric($h) || !is_numeric($m) ||
$h > 23 || $h < 0 || $m > 59 || $m < 0)
return -1;
$curm = 0;
$curh = 0;
$i = 0;
while ($curm != $m || ($curh % 24) != $h){
if($curm < 23){
$curh += 13;
$curm += 37;
} else {
$curh += 14;
$curm -= 23;
}
++$i;
}
return $i;
}
/**
* Converts leettime to standard time.
*
* @param int leet the time in leettime-format in the
* range from 0 - 1439
*
* @return var an int-Array with the hours at position 0
* and minutes at position 1 (-1 if the input parameter
* is not in range)
*/
function LeetToTime($leet){
if($leet > 1439 || $leet < 0) return array(-1, -1);
$m = $leet * 37;
$h = ($leet * 13) + ($m / 60);
return array($h % 24, $m % 60);
}
// Demonstrate usage
$h = (int)date("G");
$m = (int)date("i");
echo date("H:i")." = ".TimeToLeet($h,$m);
echo "
";
$leettime = 999;
$result = LeetToTime($leettime);
if($result[0] == -1) echo "error";
else {
$h = $result[0];
$m = $result[1];
echo $leettime." = ".($h>9?$h:"0".$h) .
":".($m>9?$m:"0".$m);
}
?>