From ac33e40d2ae7288f66f5e3d56e7ae8e3f0266144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Sun, 6 May 2012 13:06:44 +0200 Subject: Keep date precision in MessageFormatter. MessageFormatter::parse and MessageFormat::format (and their static equivalents) now don't throw away better than second precision in the arguments. It's already bad enough that in MessageFormatter and IntlDateFormatter we use seconds since epoch instead of milliseconds since epoch, deviating from the ICU date representations. But we don't need to throw away extra precision when parsing dates; we can keep the seconds since epoch convention and return non integer doubles with only a small BC impact. Note that we already could return doubles from MessageFormatter::parse if the date was sufficiently in the past or in the future. --- ext/intl/msgformat/msgformat_helpers.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'ext/intl/msgformat/msgformat_helpers.cpp') diff --git a/ext/intl/msgformat/msgformat_helpers.cpp b/ext/intl/msgformat/msgformat_helpers.cpp index 42c5466153..f8228df4d3 100755 --- a/ext/intl/msgformat/msgformat_helpers.cpp +++ b/ext/intl/msgformat/msgformat_helpers.cpp @@ -665,11 +665,7 @@ U_CFUNC void umsg_parse_helper(UMessageFormat *fmt, int *count, zval ***args, UC switch(fargs[i].getType()) { case Formattable::kDate: aDate = ((double)fargs[i].getDate())/U_MILLIS_PER_SECOND; - if(aDate > LONG_MAX || aDate < -LONG_MAX) { - ZVAL_DOUBLE((*args)[i], aDate<0?ceil(aDate):floor(aDate)); - } else { - ZVAL_LONG((*args)[i], (long)aDate); - } + ZVAL_DOUBLE((*args)[i], aDate); break; case Formattable::kDouble: -- cgit v1.2.1