예제 #1
0
 public function testTimestamp()
 {
     $key = Base36TimeKey::generate(123456789);
     $this->assertEquals(123456789, floor(Base36TimeKey::getMsTime($key)));
     for ($x = 0; $x < 10; $x++) {
         $limit = 7000;
         for ($i = 0; $i < $limit; $i++) {
             $microtime = microtime(true);
             $key = Base36TimeKey::generate($microtime);
             $this->assertEquals(floor((string) $microtime), floor((string) Base36TimeKey::getMsTime($key)));
         }
     }
 }
예제 #2
0
파일: FidDescription.php 프로젝트: fid/php
 public function __construct($fid)
 {
     $fid = strtoupper($fid);
     $this->timeKey = substr($fid, 9, 9);
     $this->indicator = substr($fid, 0, 1);
     $this->vendor = substr($fid, 1, 3);
     $this->app = substr($fid, 4, 2);
     $this->type = substr($fid, 6, 2);
     $this->location = substr($fid, 19, 5);
     $this->random = substr($fid, 25, 7);
     $this->verify = substr($fid, 31, 1);
     $ts = Base36TimeKey::getMsTime($this->timeKey);
     $this->timestampMs = $ts * 1000;
     $this->timestamp = floor($ts);
 }