* * @return string a string representation of this time, not null */ public function __toString() { $buf = ""; $hourValue = $this->hour; $minuteValue = $this->minute; $secondValue = $this->second; $nanoValue = $this->nano; $buf .= ($hourValue < 10 ? "0" : "") . $hourValue . ($minuteValue < 10 ? ":0" : ":") . $minuteValue; if ($secondValue > 0 || $nanoValue > 0) { $buf .= ($secondValue < 10 ? ":0" : ":") . $secondValue; if ($nanoValue > 0) { $buf .= '.'; if ($nanoValue % 1000000 == 0) { $buf .= substr(Math::div($nanoValue, 1000000) + 1000, 1); } else { if ($nanoValue % 1000 == 0) { $buf .= substr(Math::div($nanoValue, 1000) + 1000000, 1); } else { $buf .= substr($nanoValue + 1000000000, 1); } } } } return $buf; } } LocalTime::init();