File: MicroSecondTime.php Lines 2 to 21 |
|
2 | /** |
|
3 | * μ秒を上手に扱う |
|
4 | */ |
|
5 | |
|
6 | namespace Puyo\Time; |
|
7 | |
|
8 | /** |
|
9 | * MicrosecondTime |
|
10 | */ |
| | class MicroSecondTime |
|
12 | { |
|
13 | /** |
|
14 | * Microsecond part. |
|
15 | * |
|
16 | * 0.12345678 |
|
17 | * @var float |
|
18 | */ |
|
19 | private $_usec = 0.0; |
|
20 | |
|
21 | /** |
|
File: MicroSecondTime.php Lines 34 to 53 |
|
34 | * 1. __construct(float $usec, float $sec) |
|
35 | * 2. __construct(string strMicrotime) |
|
36 | * 3. __construct(void) |
|
37 | * </pre> |
|
38 | * |
|
39 | * @param mixed $arg1 |
|
40 | * @param float $arg2 |
|
41 | * @throws \InvalidArgumentException |
|
42 | */ |
| | public function __construct($arg1 = null, $arg2 = null) { |
|
44 | // Pseudo overload |
|
45 | |
|
46 | if (isset($arg1) && is_float($arg1) && isset($arg2) && is_float($arg2)) { |
|
47 | // 1. __construct(float $usec, float $sec) |
|
48 | $this->_usec = $arg1; |
|
49 | $this->_sec = $arg2; |
|
50 | } elseif (isset($arg1) && is_string($arg1) && is_null($arg2)) { |
|
51 | // 2. __construct(string strMicrotime) |
|
52 | $this->setMicrotimeString($arg1); |
|
53 | } elseif ($arg1 === null && $arg2 === null) { |
|