|
|
@@ -4514,24 +4514,26 @@ class Zend_Date extends Zend_Date_DateObject
|
|
|
}
|
|
|
|
|
|
if ($precision === null) {
|
|
|
- // Use internal default precision
|
|
|
- // Is not as logic as using the length of the input. But this would break tests and maybe other things
|
|
|
- // as an input value of integer 10, which is used in tests, must be parsed as 10 milliseconds (real milliseconds, precision 3)
|
|
|
- // but with auto-detect of precision, 100 milliseconds would be added.
|
|
|
+ // Use internal default precision
|
|
|
+ // Is not as logic as using the length of the input. But this would break tests and maybe other things
|
|
|
+ // as an input value of integer 10, which is used in tests, must be parsed as 10 milliseconds (real milliseconds, precision 3)
|
|
|
+ // but with auto-detect of precision, 100 milliseconds would be added.
|
|
|
$precision = $this->_precision;
|
|
|
}
|
|
|
|
|
|
if (!is_int($precision) || $precision < 1 || $precision > 9) {
|
|
|
require_once 'Zend/Date/Exception.php';
|
|
|
- throw new Zend_Date_Exception("precision ($precision) must be a positive integer less than 10", 0, null, $precision);
|
|
|
+ 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 = round($milli / pow(10, $precision - $this->_precision));
|
|
|
}
|
|
|
|
|
|
- if ($this->_precision > $precision) {
|
|
|
- $milli = $milli * pow(10, $this->_precision - $precision);
|
|
|
- } elseif ($this->_precision < $precision) {
|
|
|
- $milli = round($milli / pow(10, $precision - $this->_precision));
|
|
|
- }
|
|
|
-
|
|
|
$this->_fractional += $milli;
|
|
|
|
|
|
// Add/sub milliseconds + add/sub seconds
|