From fdb88d36376b2d81c6db746617f1bf3cd303c01f Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Wed, 9 Jan 2013 17:28:44 -0600 Subject: [PATCH] Updating for changes made to the Moontoast\Math\BigNumber interface --- src/Rhumsaa/Uuid/Uuid.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Rhumsaa/Uuid/Uuid.php b/src/Rhumsaa/Uuid/Uuid.php index cc19693..1d42db4 100644 --- a/src/Rhumsaa/Uuid/Uuid.php +++ b/src/Rhumsaa/Uuid/Uuid.php @@ -313,9 +313,11 @@ class Uuid } elseif (self::hasBigNumber()) { - $ts = new \Moontoast\Math\BigNumber($this->getTimestampHex(), null, 16); + $time = \Moontoast\Math\BigNumber::baseConvert($this->getTimestampHex(), 16, 10); + + $ts = new \Moontoast\Math\BigNumber($time, 20); $ts->subtract('122192928000000000'); - $ts->divide('10000000.0', 20); + $ts->divide('10000000.0'); $ts->round(); $unixTime = $ts->getValue(); @@ -385,7 +387,13 @@ class Uuid ); } - return new \Moontoast\Math\BigNumber($this->getLeastSignificantBitsHex(), null, 16); + $number = \Moontoast\Math\BigNumber::baseConvert( + $this->getLeastSignificantBitsHex(), + 16, + 10 + ); + + return new \Moontoast\Math\BigNumber($number); } /** @@ -419,7 +427,13 @@ class Uuid ); } - return new \Moontoast\Math\BigNumber($this->getMostSignificantBitsHex(), null, 16); + $number = \Moontoast\Math\BigNumber::baseConvert( + $this->getMostSignificantBitsHex(), + 16, + 10 + ); + + return new \Moontoast\Math\BigNumber($number); } /**