Martin Winkel 11 лет назад
Родитель
Сommit
2ea0e0ba0c
1 измененных файлов с 7 добавлено и 4 удалено
  1. 7 4
      library/Zend/Date.php

+ 7 - 4
library/Zend/Date.php

@@ -4514,10 +4514,7 @@ class Zend_Date extends Zend_Date_DateObject
         }
 
         if ($precision === null) {
-            $precision = strlen($milli);
-            if ($milli < 0) {
-                --$precision;
-            }
+            $precision = $this->_precision;
         }
 
         if (!is_int($precision) || $precision < 1 || $precision > 9) {
@@ -4525,6 +4522,12 @@ class Zend_Date extends Zend_Date_DateObject
             throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision);
         }
 
+		if ($this->_precision > $precision) {
+			$milli = $milli * pow(10, $this->_precision - $precision);
+		} elseif ($this->_precision < $precision) {
+			$milli = $milli / pow(10, $precision - $this->_precision);
+		}
+		
         $this->_fractional += $milli;
 
         // Add/sub milliseconds + add/sub seconds