private function parseTimeString($timestamp)
    {
        $nanoRegex = '/\d{4}-\d{1,2}-\d{1,2}T\d{1,2}\:\d{1,2}\:\d{1,2}(?:\.(\d{1,}))?/';

        preg_match($nanoRegex, $timestamp, $matches);
        $subSeconds = isset($matches[1])
            ? $matches[1]
            : '0';

        if (strlen($subSeconds) > 6) {
            $timestamp = str_replace('.'. $subSeconds, '.' . substr($subSeconds, 0, 6), $timestamp);
        }

        $dt = new \DateTimeImmutable($timestamp);
        if (!$dt) {
            throw new \InvalidArgumentException(sprintf(
                'Could not create a DateTime instance from given timestamp %s.',
                $timestamp
            ));
        }

        $nanos = (int) str_pad($subSeconds, 9, '0', STR_PAD_RIGHT);

        return [$dt, $nanos];
    }