Lines Matching defs:nanoseconds
418 $nanoseconds = 0;
423 // the length of the nanoseconds text
434 throw new \Exception("Nanoseconds must be in the range of 0 to 999,999,999 nanoseconds.");
437 $nanoseconds = substr($timestamp, $periodIndex + 1, $nanosecondsLength);
438 $nanoseconds = intval($nanoseconds);
440 // remove the nanoseconds and preceding period from the timestamp
455 $value->setNanos($nanoseconds);
467 $nanoseconds = static::getNanosecondsForTimestamp($value->getNanos());
468 if (!empty($nanoseconds)) {
469 $nanoseconds = ".".$nanoseconds;
472 return $date->format("Y-m-d\TH:i:s".$nanoseconds."\Z");
577 public static function getNanosecondsForTimestamp($nanoseconds)
579 if ($nanoseconds == 0) {
582 if ($nanoseconds % static::NANOS_PER_MILLISECOND == 0) {
583 return sprintf('%03d', $nanoseconds / static::NANOS_PER_MILLISECOND);
585 if ($nanoseconds % static::NANOS_PER_MICROSECOND == 0) {
586 return sprintf('%06d', $nanoseconds / static::NANOS_PER_MICROSECOND);
588 return sprintf('%09d', $nanoseconds);