Provides common value mapping methods.

public createTimestampWithNanos( $timestamp, $returnType = 'Google\Cloud\Core\Timestamp')

Convert a timestamp (represented as a string or an array) to a Timestamp
class with nanosecond support.

  • deprecated Use methods on {@see \Google\Cloud\Core\TimeTrait}.
  • return mixed
private convertFractionToNanoSeconds( $subseconds)

Convert subseconds, expressed as a decimal to nanoseconds.

  • return int
private convertNanoSecondsToFraction( $nanos, $rpad = true)

Convert nanoseconds to subseconds.

Note that result should be used as a fraction of one second, but is
given as an integer.

  • return string
private createDateTimeFromSeconds( $seconds)

Create a DateTimeImmutable instance from a UNIX timestamp (i.e. seconds since epoch).

  • return DateTimeImmutable
private formatTimeAsArray(DateTimeInterface $dateTime, $ns)

Format a timestamp for the API with nanosecond precision.

  • return array
private formatTimeAsString(DateTimeInterface $dateTime, $ns)

Create a Timestamp string in an API-compatible format.

  • return string
private parseTimeString( $timestamp)

Parse a Timestamp string and return a DateTimeImmutable instance and nanoseconds as an integer.

  • return array [\DateTimeImmutable, int]
  • throws Exception If the timestamp string is in an unrecognized format.
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only