Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PhpTimeConverter.php

function PhpTimeConverter::convertTime

Overrides TimeConverterInterface::convertTime

File

vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php, line 106

Class

PhpTimeConverter
PhpTimeConverter uses built-in PHP functions and standard math operations available to the PHP programming language to provide facilities for converting parts of time into representations that may be used in UUIDs

Namespace

Ramsey\Uuid\Converter\Time

Code

public function convertTime(Hexadecimal $uuidTimestamp) : Time {
    $timestamp = $this->calculator
        ->toInteger($uuidTimestamp);
    // Convert the 100-nanosecond intervals into seconds and microseconds.
    $splitTime = $this->splitTime(((int) $timestamp->toString() - self::GREGORIAN_TO_UNIX_INTERVALS) / self::SECOND_INTERVALS);
    if (count($splitTime) === 0) {
        return $this->fallbackConverter
            ->convertTime($uuidTimestamp);
    }
    return new Time($splitTime['sec'], $splitTime['usec']);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal