diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-03-17 08:36:26 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-18 21:34:46 +0200 |
commit | 9830fd36dbdb72c79703b0c61efc027fba793c5a (patch) | |
tree | 2e9d698e6ca109dc6627adb5c84aa2b635bcfe92 /ucb | |
parent | 5aaaf0694b6e3213685563fc3bc90d19b10f5c75 (diff) |
date/time IDL datatypes incompatible change
- nanosecond precision
- signed (allowed negative) year
Also: assorted improvements / bugfixes in date/time handling code.
Some factorisation of copy/pasted code.
Change-Id: I761a1b0b8731c82f19a0c37acbcf43d3c06d6cd6
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/sorter/sortresult.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/cmis/cmis_content.cxx | 10 | ||||
-rw-r--r-- | ucb/source/ucp/file/shell.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ftpdirp.cxx | 6 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ftpdirp.hxx | 8 |
5 files changed, 18 insertions, 16 deletions
diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index 089946a4f7de..4e72d45932ed 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -1133,8 +1133,8 @@ long SortedResultSet::CompareImpl( Reference < XResultSet > xResultOne, if ( !nTmp ) { nTmp = (sal_Int32) aTwo.Seconds - (sal_Int32) aOne.Seconds; if ( !nTmp ) - nTmp = (sal_Int32) aTwo.HundredthSeconds - - (sal_Int32) aOne.HundredthSeconds; + nTmp = (sal_Int32) aTwo.NanoSeconds + - (sal_Int32) aOne.NanoSeconds; }} if ( nTmp < 0 ) @@ -1168,8 +1168,8 @@ long SortedResultSet::CompareImpl( Reference < XResultSet > xResultOne, if ( !nTmp ) { nTmp = (sal_Int32) aTwo.Seconds - (sal_Int32) aOne.Seconds; if ( !nTmp ) - nTmp = (sal_Int32) aTwo.HundredthSeconds - - (sal_Int32) aOne.HundredthSeconds; + nTmp = (sal_Int32) aTwo.NanoSeconds + - (sal_Int32) aOne.NanoSeconds; }}}}} if ( nTmp < 0 ) diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx index a32fdbbb11d3..3675a706c5e1 100644 --- a/ucb/source/ucp/cmis/cmis_content.cxx +++ b/ucb/source/ucp/cmis/cmis_content.cxx @@ -85,11 +85,13 @@ namespace unoTime.Minutes = boostTime.time_of_day().minutes(); unoTime.Seconds = boostTime.time_of_day().seconds(); - long total_milli = boostTime.time_of_day().total_milliseconds( ); - long milli = total_milli - boostTime.time_of_day().total_seconds( ); - long hundredthSeconds = milli / 10; + // TODO FIXME maybe we should compile with BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG + // to actually get nanosecond precision in boostTime? + // use this way rather than total_nanos to avoid overflows with 32-bit long + const long ticks = boostTime.time_of_day().fractional_seconds(); + long nanoSeconds = ticks * ( 1000000000 / boost::posix_time::time_duration::ticks_per_second()); - unoTime.HundredthSeconds = hundredthSeconds; + unoTime.NanoSeconds = nanoSeconds; return unoTime; } diff --git a/ucb/source/ucp/file/shell.cxx b/ucb/source/ucp/file/shell.cxx index 23221fcb3968..ec7bce87f18a 100644 --- a/ucb/source/ucp/file/shell.cxx +++ b/ucb/source/ucp/file/shell.cxx @@ -2431,7 +2431,7 @@ shell::commit( const shell::ContentMap::iterator& it, osl_getDateTimeFromTimeValue( &myLocalTime, &myDateTime ); util::DateTime aDateTime; - aDateTime.HundredthSeconds = (unsigned short)(myDateTime.NanoSeconds / 10000000); + aDateTime.NanoSeconds = myDateTime.NanoSeconds; aDateTime.Seconds = myDateTime.Seconds; aDateTime.Minutes = myDateTime.Minutes; aDateTime.Hours = myDateTime.Hours; diff --git a/ucb/source/ucp/ftp/ftpdirp.cxx b/ucb/source/ucp/ftp/ftpdirp.cxx index 2e6bece679a9..87f38b88a569 100644 --- a/ucb/source/ucp/ftp/ftpdirp.cxx +++ b/ucb/source/ucp/ftp/ftpdirp.cxx @@ -828,7 +828,7 @@ sal_Bool FTPDirectoryParser::parseVMS ( /* * Parse <minute> part and set entry time's minutes, - * seconds (0), and 1/100 seconds (0). + * seconds (0), and nanoseconds (0). */ if (*p < '0' || *p > '5') return sal_False; @@ -840,7 +840,7 @@ sal_Bool FTPDirectoryParser::parseVMS ( nMinute = 10 * nMinute + (*p++ - '0'); rEntry.m_aDate.SetMin(nMinute); rEntry.m_aDate.SetSec(0); - rEntry.m_aDate.Set100Sec(0); + rEntry.m_aDate.SetNanoSec(0); // Skip <rest> part: if (*p && (*p != '\t' && *p != ' ')) @@ -1202,7 +1202,7 @@ sal_Bool FTPDirectoryParser::parseUNIX_isTime ( rDateTime.SetHour (nHour); rDateTime.SetMin (nMin); rDateTime.SetSec (0); - rDateTime.Set100Sec (0); + rDateTime.SetNanoSec (0); // Date aCurDate; // if (rDateTime.GetMonth() > aCurDate.GetMonth()) diff --git a/ucb/source/ucp/ftp/ftpdirp.hxx b/ucb/source/ucp/ftp/ftpdirp.hxx index 68dc11879c0b..f8e04b9f138f 100644 --- a/ucb/source/ucp/ftp/ftpdirp.hxx +++ b/ucb/source/ucp/ftp/ftpdirp.hxx @@ -41,14 +41,14 @@ namespace ftp { struct DateTime : public com::sun::star::util::DateTime { - DateTime(const sal_uInt16& hundredthSeconds, + DateTime(const sal_uInt32& nanoSeconds, const sal_uInt16& seconds, const sal_uInt16& minutes, const sal_uInt16& hours, const sal_uInt16& day, const sal_uInt16& month, const sal_uInt16& year) SAL_THROW(()) - : com::sun::star::util::DateTime(hundredthSeconds, + : com::sun::star::util::DateTime(nanoSeconds, seconds, minutes, hours, @@ -60,11 +60,11 @@ namespace ftp { void SetMonth(sal_uInt16 month) { Month = month; } void SetDay(sal_uInt16 day) { Day = day; } // Only zero allowed and used for time-argument - void SetTime(sal_uInt16) { Hours = Minutes = Seconds = HundredthSeconds = 0; } + void SetTime(sal_uInt16) { Hours = Minutes = Seconds = NanoSeconds = 0; } void SetHour(sal_uInt16 hours) { Hours = hours; } void SetMin(sal_uInt16 minutes) { Minutes = minutes; } void SetSec(sal_uInt16 seconds) { Seconds = seconds; } - void Set100Sec(sal_uInt16 hundredthSec) { HundredthSeconds = hundredthSec; } + void SetNanoSec(sal_uInt32 nanoSec) { NanoSeconds = nanoSec; } sal_uInt16 GetMonth(void) { return Month; } }; |