[Libreoffice-commits] core.git: basic/source comphelper/source connectivity/inc connectivity/source editeng/source extensions/source filter/source forms/qa forms/source framework/source odk/examples offapi/com offapi/type_reference oox/source qadevOOo/tests reportbuilder/java reportdesign/source sax/qa sax/source sc/inc scripting/source sc/source sd/source sfx2/qa sfx2/source svl/source svtools/source svx/source sw/source tools/inc tools/Library_tl.mk tools/source ucb/source unotools/inc unotools/source vcl/source wizards/com xmloff/source xmlsecurity/source

Lionel Elie Mamane lionel at mamane.lu
Thu Apr 18 12:35:55 PDT 2013


 basic/source/runtime/methods.cxx                                    |    2 
 comphelper/source/misc/anycompare.cxx                               |    4 
 comphelper/source/misc/types.cxx                                    |    4 
 connectivity/inc/connectivity/dbconversion.hxx                      |   10 
 connectivity/source/commontools/FValue.cxx                          |    8 
 connectivity/source/commontools/dbconversion.cxx                    |  154 ++-
 connectivity/source/drivers/calc/CTable.cxx                         |   20 
 connectivity/source/drivers/dbase/DTable.cxx                        |    2 
 connectivity/source/drivers/file/FDateFunctions.cxx                 |    4 
 connectivity/source/drivers/jdbc/ConnectionLog.cxx                  |    8 
 connectivity/source/drivers/kab/KResultSet.cxx                      |    2 
 connectivity/source/drivers/macab/macabutilities.hxx                |    2 
 connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx |    2 
 connectivity/source/drivers/odbcbase/OPreparedStatement.cxx         |   45 -
 connectivity/source/drivers/odbcbase/OResultSet.cxx                 |    2 
 connectivity/source/drivers/postgresql/pq_tools.cxx                 |   21 
 connectivity/source/inc/odbc/OTools.hxx                             |    3 
 editeng/source/items/flditem.cxx                                    |    2 
 editeng/source/uno/unofield.cxx                                     |    4 
 extensions/source/logging/csvformatter.cxx                          |    4 
 extensions/source/logging/logrecord.cxx                             |    2 
 extensions/source/logging/plaintextformatter.cxx                    |    4 
 extensions/source/propctrlr/formcomponenthandler.cxx                |    4 
 extensions/source/propctrlr/standardcontrol.cxx                     |    4 
 filter/source/msfilter/svdfppt.cxx                                  |    5 
 forms/qa/integration/forms/TimeValidator.java                       |    4 
 forms/source/component/Time.cxx                                     |   13 
 forms/source/xforms/convert.cxx                                     |  102 --
 forms/source/xforms/datatypes.cxx                                   |   13 
 framework/source/jobs/jobdata.cxx                                   |    1 
 odk/examples/DevelopersGuide/Forms/TimeValidator.java               |    4 
 offapi/com/sun/star/util/Date.idl                                   |    2 
 offapi/com/sun/star/util/DateTime.idl                               |    9 
 offapi/com/sun/star/util/DateTimeRange.idl                          |   13 
 offapi/com/sun/star/util/Duration.idl                               |    4 
 offapi/com/sun/star/util/Time.idl                                   |    4 
 offapi/type_reference/types.rdb                                     |binary
 oox/source/core/xmlfilterbase.cxx                                   |    6 
 oox/source/dump/dumperbase.cxx                                      |   10 
 oox/source/ppt/comments.cxx                                         |   24 
 qadevOOo/tests/java/mod/_forms/ODatabaseForm.java                   |    4 
 reportbuilder/java/org/libreoffice/report/SDBCReportData.java       |    2 
 reportdesign/source/filter/xml/xmlControlProperty.cxx               |   10 
 sax/qa/cppunit/test_converter.cxx                                   |   47 -
 sax/source/tools/converter.cxx                                      |  204 ++--
 sc/inc/chgtrack.hxx                                                 |    8 
 sc/source/core/data/dbdocutl.cxx                                    |   12 
 sc/source/core/data/dpobject.cxx                                    |   14 
 sc/source/core/tool/chgtrack.cxx                                    |    4 
 sc/source/core/tool/chgviset.cxx                                    |    2 
 sc/source/core/tool/interpr2.cxx                                    |   19 
 sc/source/filter/html/htmlexp.cxx                                   |    2 
 sc/source/filter/oox/unitconverter.cxx                              |    4 
 sc/source/filter/xcl97/XclExpChangeTrack.cxx                        |    6 
 sc/source/filter/xcl97/XclImpChangeTrack.cxx                        |    2 
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx              |   12 
 sc/source/filter/xml/XMLConverter.cxx                               |    4 
 sc/source/ui/docshell/docsh3.cxx                                    |   12 
 sc/source/ui/miscdlgs/sharedocdlg.cxx                               |    2 
 sc/source/ui/unoobj/fielduno.cxx                                    |    6 
 sc/source/ui/view/viewfun6.cxx                                      |    8 
 scripting/source/pyprov/pythonscript.py                             |    2 
 sd/source/filter/eppt/eppt.cxx                                      |    3 
 sd/source/filter/eppt/pptx-epptooxml.cxx                            |    2 
 sd/source/ui/annotations/annotationmanager.cxx                      |    2 
 sd/source/ui/dlg/animobjs.cxx                                       |    2 
 sfx2/qa/complex/sfx2/DocumentProperties.java                        |   10 
 sfx2/source/appl/sfxpicklist.cxx                                    |    2 
 sfx2/source/bastyp/frmhtmlw.cxx                                     |    4 
 sfx2/source/dialog/dinfdlg.cxx                                      |   16 
 sfx2/source/dialog/versdlg.cxx                                      |    2 
 sfx2/source/doc/SfxDocumentMetaData.cxx                             |    8 
 sfx2/source/doc/objcont.cxx                                         |    8 
 sfx2/source/doc/oleprops.cxx                                        |    6 
 sfx2/source/view/viewprn.cxx                                        |    2 
 svl/source/items/dateitem.cxx                                       |    4 
 svl/source/misc/fstathelper.cxx                                     |    2 
 svtools/source/contnr/DocumentInfoPreview.cxx                       |    2 
 svtools/source/contnr/contentenumeration.cxx                        |    2 
 svtools/source/misc/templatefoldercache.cxx                         |    8 
 svtools/source/svhtml/parhtml.cxx                                   |    2 
 svtools/source/table/cellvalueconversion.cxx                        |    4 
 svx/source/fmcomp/gridcell.cxx                                      |    2 
 sw/source/core/doc/doccomp.cxx                                      |    2 
 sw/source/core/doc/docglbl.cxx                                      |    2 
 sw/source/core/doc/docredln.cxx                                     |    2 
 sw/source/core/fields/docufld.cxx                                   |   14 
 sw/source/core/fields/flddat.cxx                                    |    4 
 sw/source/core/unocore/swunohelper.cxx                              |    2 
 sw/source/core/unocore/unoredline.cxx                               |    2 
 sw/source/filter/ww8/wrtww8.cxx                                     |    6 
 sw/source/filter/ww8/ww8par.cxx                                     |    2 
 sw/source/filter/xml/XMLRedlineImportHelper.cxx                     |    2 
 tools/Library_tl.mk                                                 |    6 
 tools/inc/tools/datetime.hxx                                        |    4 
 tools/inc/tools/time.hxx                                            |   50 -
 tools/source/datetime/datetime.cxx                                  |   18 
 tools/source/datetime/ttime.cxx                                     |  246 +++--
 tools/source/inet/inetmsg.cxx                                       |    6 
 tools/source/rc/rc.cxx                                              |    5 
 ucb/source/sorter/sortresult.cxx                                    |    8 
 ucb/source/ucp/cmis/cmis_content.cxx                                |   10 
 ucb/source/ucp/file/shell.cxx                                       |    2 
 ucb/source/ucp/ftp/ftpdirp.cxx                                      |    6 
 ucb/source/ucp/ftp/ftpdirp.hxx                                      |    8 
 unotools/inc/unotools/datetime.hxx                                  |    6 
 unotools/source/i18n/localedatawrapper.cxx                          |   32 
 unotools/source/misc/datetime.cxx                                   |  434 +++++++++-
 unotools/source/ucbhelper/ucbhelper.cxx                             |    2 
 vcl/source/control/field2.cxx                                       |   16 
 wizards/com/sun/star/wizards/common/JavaTools.java                  |    2 
 xmloff/source/core/xmluconv.cxx                                     |   11 
 xmloff/source/draw/animationimport.cxx                              |    2 
 xmloff/source/draw/propimp0.cxx                                     |    5 
 xmloff/source/forms/elementexport.cxx                               |    2 
 xmloff/source/forms/elementimport.cxx                               |    2 
 xmloff/source/forms/handler/vcl_time_handler.cxx                    |    4 
 xmloff/source/forms/propertyexport.cxx                              |   12 
 xmloff/source/forms/propertyimport.cxx                              |   20 
 xmloff/source/style/durationhdl.cxx                                 |    5 
 xmloff/source/text/txtflde.cxx                                      |    2 
 xmloff/source/xforms/SchemaRestrictionContext.cxx                   |    2 
 xmloff/source/xforms/xformsexport.cxx                               |    2 
 xmlsecurity/source/component/documentdigitalsignatures.cxx          |    2 
 xmlsecurity/source/dialogs/resourcemanager.cxx                      |    2 
 xmlsecurity/source/helper/xmlsignaturehelper.cxx                    |    2 
 xmlsecurity/source/helper/xsecctl.cxx                               |  206 ----
 xmlsecurity/source/helper/xsecctl.hxx                               |    4 
 xmlsecurity/source/helper/xsecverify.cxx                            |    3 
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx   |    5 
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx           |    5 
 131 files changed, 1309 insertions(+), 898 deletions(-)

New commits:
commit 9830fd36dbdb72c79703b0c61efc027fba793c5a
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun Mar 17 08:36:26 2013 +0100

    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

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 0f5f76d..b5da3b1 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -3051,7 +3051,7 @@ RTLFUNC(FileDateTime)
                 try
                 {
                     util::DateTime aUnoDT = xSFI->getDateTimeModified( aPath );
-                    aTime = Time( aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, aUnoDT.HundredthSeconds );
+                    aTime = Time( aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, aUnoDT.NanoSeconds );
                     aDate = Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year );
                 }
                 catch(const Exception & )
diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx
index 470be26..775386e 100644
--- a/comphelper/source/misc/anycompare.cxx
+++ b/comphelper/source/misc/anycompare.cxx
@@ -116,7 +116,7 @@ namespace comphelper
             if ( lhs.Seconds > rhs.Seconds )
                 return false;
 
-            if ( lhs.HundredthSeconds < rhs.HundredthSeconds )
+            if ( lhs.NanoSeconds < rhs.NanoSeconds )
                 return true;
             return false;
         }
@@ -166,7 +166,7 @@ namespace comphelper
             if ( lhs.Seconds > rhs.Seconds )
                 return false;
 
-            if ( lhs.HundredthSeconds < rhs.HundredthSeconds )
+            if ( lhs.NanoSeconds < rhs.NanoSeconds )
                 return true;
             return false;
         }
diff --git a/comphelper/source/misc/types.cxx b/comphelper/source/misc/types.cxx
index e77176f..fbf49f3 100644
--- a/comphelper/source/misc/types.cxx
+++ b/comphelper/source/misc/types.cxx
@@ -44,7 +44,7 @@ using namespace ::com::sun::star::lang;
 //-------------------------------------------------------------------------
 sal_Bool operator ==(const DateTime& _rLeft, const DateTime& _rRight)
 {
-    return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
+    return ( _rLeft.NanoSeconds == _rRight.NanoSeconds) &&
     ( _rLeft.Seconds == _rRight.Seconds) &&
     ( _rLeft.Minutes == _rRight.Minutes) &&
     ( _rLeft.Hours == _rRight.Hours) &&
@@ -64,7 +64,7 @@ sal_Bool operator ==(const Date& _rLeft, const Date& _rRight)
 //-------------------------------------------------------------------------
 sal_Bool operator ==(const Time& _rLeft, const Time& _rRight)
 {
-    return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
+    return ( _rLeft.NanoSeconds == _rRight.NanoSeconds) &&
     ( _rLeft.Seconds == _rRight.Seconds) &&
     ( _rLeft.Minutes == _rRight.Minutes) &&
     ( _rLeft.Hours == _rRight.Hours) ;
diff --git a/connectivity/inc/connectivity/dbconversion.hxx b/connectivity/inc/connectivity/dbconversion.hxx
index e8516d1..9536c79 100644
--- a/connectivity/inc/connectivity/dbconversion.hxx
+++ b/connectivity/inc/connectivity/dbconversion.hxx
@@ -111,7 +111,9 @@ namespace dbtools
         static ::com::sun::star::util::DateTime toDateTime(const OUString& _sSQLDate);
 
 
+        // TODO: consider removing getMsFromTime
         static sal_Int32 getMsFromTime(const ::com::sun::star::util::Time& rVal);
+        static sal_Int64 getNsFromTime(const ::com::sun::star::util::Time& rVal);
 
         static sal_Int32 toDays(const ::com::sun::star::util::Date& _rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
 
@@ -120,10 +122,10 @@ namespace dbtools
         static double   toDouble(const ::com::sun::star::util::DateTime& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
 
         static sal_Int32    toINT32(const ::com::sun::star::util::Date& rVal);
-        static sal_Int32    toINT32(const ::com::sun::star::util::Time& rVal);
+        static sal_Int64    toINT64(const ::com::sun::star::util::Time& rVal);
 
         static ::com::sun::star::util::Date toDate(sal_Int32 _nVal);
-        static ::com::sun::star::util::Time toTime(sal_Int32 _nVal);
+        static ::com::sun::star::util::Time toTime(sal_Int64 _nVal);
 
         /** convert a double which is a date value relative to a given fixed date into a date value relative
             to the standard db null date.
@@ -139,9 +141,9 @@ namespace dbtools
 
         // return the date in the format %04d-%02d-%02d
         static OUString toDateString(const ::com::sun::star::util::Date& rDate);
-        // return the time in the format %02d:%02d:%02d
+        // return the time in the format %02d:%02d:%02d.%09d
         static OUString toTimeString(const ::com::sun::star::util::Time& rTime);
-        // return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d
+        // return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d.%09d
         static OUString toDateTimeString(const ::com::sun::star::util::DateTime& _rDateTime);
         // return the any in an sql standard format
         static OUString toSQLString(sal_Int32 eType, const ::com::sun::star::uno::Any& _rVal, sal_Bool bQuote,
diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx
index ef968fb..770b34e 100644
--- a/connectivity/source/commontools/FValue.cxx
+++ b/connectivity/source/commontools/FValue.cxx
@@ -746,14 +746,14 @@ bool operator==(const Date& _rLH,const Date& _rRH)
 
 bool operator==(const Time& _rLH,const Time& _rRH)
 {
-    return _rLH.Minutes == _rRH.Minutes && _rLH.Hours == _rRH.Hours && _rLH.Seconds == _rRH.Seconds && _rLH.HundredthSeconds == _rRH.HundredthSeconds;
+    return _rLH.Minutes == _rRH.Minutes && _rLH.Hours == _rRH.Hours && _rLH.Seconds == _rRH.Seconds && _rLH.NanoSeconds == _rRH.NanoSeconds;
 }
 // -------------------------------------------------------------------------
 
 bool operator==(const DateTime& _rLH,const DateTime& _rRH)
 {
     return _rLH.Day == _rRH.Day && _rLH.Month == _rRH.Month && _rLH.Year == _rRH.Year &&
-        _rLH.Minutes == _rRH.Minutes && _rLH.Hours == _rRH.Hours && _rLH.Seconds == _rRH.Seconds && _rLH.HundredthSeconds == _rRH.HundredthSeconds;
+        _rLH.Minutes == _rRH.Minutes && _rLH.Hours == _rRH.Hours && _rLH.Seconds == _rRH.Seconds && _rLH.NanoSeconds == _rRH.NanoSeconds;
 }
 // -------------------------------------------------------------------------
 
@@ -2020,7 +2020,7 @@ Sequence<sal_Int8>  ORowSetValue::getSequence() const
             case DataType::TIMESTAMP:
                 {
                     ::com::sun::star::util::DateTime* pDateTime = static_cast< ::com::sun::star::util::DateTime*>(m_aValue.m_pValue);
-                    aValue.HundredthSeconds = pDateTime->HundredthSeconds;
+                    aValue.NanoSeconds      = pDateTime->NanoSeconds;
                     aValue.Seconds          = pDateTime->Seconds;
                     aValue.Minutes          = pDateTime->Minutes;
                     aValue.Hours            = pDateTime->Hours;
@@ -2073,7 +2073,7 @@ Sequence<sal_Int8>  ORowSetValue::getSequence() const
             case DataType::TIME:
                 {
                     ::com::sun::star::util::Time* pTime = static_cast< ::com::sun::star::util::Time*>(m_aValue.m_pValue);
-                    aValue.HundredthSeconds = pTime->HundredthSeconds;
+                    aValue.NanoSeconds      = pTime->NanoSeconds;
                     aValue.Seconds          = pTime->Seconds;
                     aValue.Minutes          = pTime->Minutes;
                     aValue.Hours            = pTime->Hours;
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 0af5418..cb87151 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -31,6 +31,20 @@
 
 #define MAX_DAYS    3636532
 
+namespace
+{
+    const double fMilliSecondsPerDay = 86400000.0;
+    const sal_Int64 nanoSecInSec = 1000000000;
+    const sal_Int16 secInMin  = 60;
+    const sal_Int16 minInHour = 60;
+
+    const sal_Int64 secMask  = 1000000000;
+    const sal_Int64 minMask  = 100000000000;
+    const sal_Int64 hourMask = 10000000000000;
+
+    const double fNanoSecondsPerDay = nanoSecInSec * secInMin * minInHour * 24.0;
+}
+
 //.........................................................................
 namespace dbtools
 {
@@ -68,14 +82,15 @@ namespace dbtools
     //------------------------------------------------------------------
     OUString DBTypeConversion::toTimeString(const Time& rTime)
     {
-        sal_Char s[9];
+        const size_t buflen = 19;
+        sal_Char s[buflen];
         snprintf(s,
-                sizeof(s),
-                "%02d:%02d:%02d",
-                (int)rTime.Hours,
-                (int)rTime.Minutes,
-                (int)rTime.Seconds);
-        s[8] = 0;
+                 buflen,
+                 "%02d:%02d:%02d.%09d",
+                 rTime.Hours,
+                 rTime.Minutes,
+                 rTime.Seconds,
+                 rTime.NanoSeconds);
         return OUString::createFromAscii(s);
     }
 
@@ -85,10 +100,8 @@ namespace dbtools
         Date aDate(_rDateTime.Day,_rDateTime.Month,_rDateTime.Year);
         OUStringBuffer aTemp(toDateString(aDate));
         aTemp.appendAscii(" ");
-        Time aTime(0,_rDateTime.Seconds,_rDateTime.Minutes,_rDateTime.Hours);
+        Time aTime(_rDateTime.NanoSeconds,_rDateTime.Seconds,_rDateTime.Minutes,_rDateTime.Hours);
         aTemp.append( toTimeString(aTime) );
-        aTemp.appendAscii(".");
-        aTemp.append( static_cast<sal_Int32>(_rDateTime.HundredthSeconds));
         return  aTemp.makeStringAndClear();
     }
     //------------------------------------------------------------------------------
@@ -102,17 +115,17 @@ namespace dbtools
     }
 
     //------------------------------------------------------------------------------
-    Time DBTypeConversion::toTime(sal_Int32 _nVal)
+    Time DBTypeConversion::toTime(sal_Int64 _nVal)
     {
         Time aReturn;
-        aReturn.Hours = (sal_uInt16)(((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) / 1000000);
-        aReturn.Minutes = (sal_uInt16)((((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) / 10000) % 100);
-        aReturn.Seconds = (sal_uInt16)((((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) / 100) % 100);
-        aReturn.HundredthSeconds = (sal_uInt16)(((sal_uInt32)(_nVal >= 0 ? _nVal : _nVal*-1)) % 100);
+        sal_uInt64 unVal = static_cast<sal_uInt64>(_nVal >= 0 ? _nVal : -_nVal);
+        aReturn.Hours = unVal / hourMask;
+        aReturn.Minutes = (unVal / minMask) % 100;
+        aReturn.Seconds = (unVal / secMask) % 100;
+        aReturn.NanoSeconds = unVal % secMask;
         return aReturn;
     }
 
-    const double fMilliSecondsPerDay = 86400000.0;
     //------------------------------------------------------------------------------
     sal_Int32 DBTypeConversion::toINT32(const Date& rVal)
     {
@@ -122,18 +135,21 @@ namespace dbtools
     }
 
     //------------------------------------------------------------------------------
-    sal_Int32 DBTypeConversion::toINT32(const Time& rVal)
+    sal_Int64 DBTypeConversion::toINT64(const Time& rVal)
     {
         // normalize time
-        sal_Int32 nSeconds          = rVal.Seconds + rVal.HundredthSeconds / 100;
-        sal_Int32 nHundredthSeconds = rVal.HundredthSeconds % 100;
-        sal_Int32 nMinutes          = rVal.Minutes + nSeconds / 60;
-        nSeconds                    = nSeconds % 60;
-        sal_Int32 nHours            = rVal.Hours + nMinutes / 60;
-        nMinutes                    = nMinutes % 60;
+        sal_Int32 nSeconds          = rVal.Seconds + rVal.NanoSeconds / nanoSecInSec;
+        sal_Int32 nNanoSeconds      = rVal.NanoSeconds % nanoSecInSec;
+        sal_Int32 nMinutes          = rVal.Minutes + nSeconds / secInMin;
+        nSeconds                    = nSeconds % secInMin;
+        sal_Int32 nHours            = rVal.Hours + nMinutes / minInHour;
+        nMinutes                    = nMinutes % minInHour;
 
         // assemble time
-        return (sal_Int32)(nHundredthSeconds + (nSeconds*100) + (nMinutes*10000) + (nHours*1000000));
+        return nNanoSeconds +
+               nSeconds * secMask +
+               nMinutes * minMask +
+               nHours   * hourMask;
     }
 
     //------------------------------------------------------------------------------
@@ -142,9 +158,23 @@ namespace dbtools
         sal_Int32   nHour     = rVal.Hours;
         sal_Int32   nMin      = rVal.Minutes;
         sal_Int32   nSec      = rVal.Seconds;
-        sal_Int32   n100Sec   = rVal.HundredthSeconds;
+        sal_Int32   nNanoSec  = rVal.NanoSeconds;
 
-        return ((nHour*3600000)+(nMin*60000)+(nSec*1000)+(n100Sec*10));
+        return ((nHour*3600000)+(nMin*60000)+(nSec*1000)+(nNanoSec/1000000));
+    }
+
+    //------------------------------------------------------------------------------
+    sal_Int64 DBTypeConversion::getNsFromTime(const Time& rVal)
+    {
+        sal_Int32   nHour     = rVal.Hours;
+        sal_Int32   nMin      = rVal.Minutes;
+        sal_Int32   nSec      = rVal.Seconds;
+        sal_Int32   nNanoSec  = rVal.NanoSeconds;
+
+        return nNanoSec +
+               nSec  * nanoSecInSec +
+               nMin  * (secInMin * nanoSecInSec) +
+               nHour * (minInHour * secInMin * nanoSecInSec);
     }
 
     //------------------------------------------------------------------------------
@@ -195,7 +225,7 @@ namespace dbtools
         return nDays;
     }
     //------------------------------------------------------------------------------
-    static void implBuildFromRelative( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_uInt16& rYear)
+    static void implBuildFromRelative( sal_Int32 nDays, sal_uInt16& rDay, sal_uInt16& rMonth, sal_Int16& rYear)
     {
         sal_Int32   nTempDays;
         sal_Int32   i = 0;
@@ -250,7 +280,7 @@ namespace dbtools
     //------------------------------------------------------------------------------
     double DBTypeConversion::toDouble(const Time& rVal)
     {
-        return (double)getMsFromTime(rVal) / fMilliSecondsPerDay;
+        return (double)getNsFromTime(rVal) / fNanoSecondsPerDay;
     }
 
     //------------------------------------------------------------------------------
@@ -262,7 +292,7 @@ namespace dbtools
         aTimePart.Hours             = _rVal.Hours;
         aTimePart.Minutes           = _rVal.Minutes;
         aTimePart.Seconds           = _rVal.Seconds;
-        aTimePart.HundredthSeconds  = _rVal.HundredthSeconds;
+        aTimePart.NanoSeconds       = _rVal.NanoSeconds;
 
         return ((double)nTime) + toDouble(aTimePart);
     }
@@ -325,12 +355,12 @@ namespace dbtools
     Time DBTypeConversion::toTime(double dVal)
     {
         sal_Int32 nDays     = (sal_Int32)dVal;
-        sal_Int32 nMS = sal_Int32((dVal - (double)nDays) * fMilliSecondsPerDay + 0.5);
+        sal_Int32 nNS = sal_Int32((dVal - (double)nDays) * fNanoSecondsPerDay + 0.5);
 
         sal_Int16 nSign;
-        if ( nMS < 0 )
+        if ( nNS < 0 )
         {
-            nMS *= -1;
+            nNS *= -1;
             nSign = -1;
         }
         else
@@ -339,24 +369,28 @@ namespace dbtools
         Time xRet;
         // normalize time
         // we have to sal_Int32 here because otherwise we get an overflow
-        sal_Int32 nHundredthSeconds = nMS/10;
-        sal_Int32 nSeconds          = nHundredthSeconds / 100;
-        sal_Int32 nMinutes          = nSeconds / 60;
+        sal_Int32 nNanoSeconds      = nNS;
+        sal_Int32 nSeconds          = nNanoSeconds / nanoSecInSec;
+        sal_Int32 nMinutes          = nSeconds / secInMin;
 
-        xRet.HundredthSeconds       = (sal_uInt16)(nHundredthSeconds % 100);
-        xRet.Seconds                = (sal_uInt16)(nSeconds % 60);
-        xRet.Hours                  = (sal_uInt16)(nMinutes / 60);
-        xRet.Minutes                = (sal_uInt16)(nMinutes % 60);
+        xRet.NanoSeconds            = nNanoSeconds % nanoSecInSec;
+        xRet.Seconds                = nSeconds % secInMin;
+        xRet.Hours                  = nMinutes / minInHour;
+        xRet.Minutes                = nMinutes % minInHour;
 
         // assemble time
-        sal_Int32 nTime = (sal_Int32)(xRet.HundredthSeconds + (xRet.Seconds*100) + (xRet.Minutes*10000) + (xRet.Hours*1000000)) * nSign;
+        sal_Int64 nTime = nSign *
+                          (xRet.NanoSeconds +
+                           xRet.Seconds * secMask +
+                           xRet.Minutes * minMask +
+                           xRet.Hours   * hourMask);
 
         if(nTime < 0)
         {
-            xRet.HundredthSeconds   = 99;
-            xRet.Minutes            = 59;
-            xRet.Seconds            = 59;
-            xRet.Hours              = 23;
+            xRet.NanoSeconds  = nanoSecInSec-1;
+            xRet.Seconds      = secInMin-1;
+            xRet.Minutes      = minInHour-1;
+            xRet.Hours        = 23;
         }
         return xRet;
     }
@@ -368,14 +402,14 @@ namespace dbtools
 
         DateTime xRet;
 
-        xRet.Day                = aDate.Day;
-        xRet.Month              = aDate.Month;
-        xRet.Year               = aDate.Year;
+        xRet.Day          = aDate.Day;
+        xRet.Month        = aDate.Month;
+        xRet.Year         = aDate.Year;
 
-        xRet.HundredthSeconds   = aTime.HundredthSeconds;
-        xRet.Minutes            = aTime.Minutes;
-        xRet.Seconds            = aTime.Seconds;
-        xRet.Hours              = aTime.Hours;
+        xRet.NanoSeconds  = aTime.NanoSeconds;
+        xRet.Minutes      = aTime.Minutes;
+        xRet.Seconds      = aTime.Seconds;
+        xRet.Hours        = aTime.Hours;
 
 
         return xRet;
@@ -415,7 +449,8 @@ namespace dbtools
         if ( -1 != nSeparation )
             aTime = toTime( _sSQLString.copy( nSeparation ) );
 
-        return DateTime(aTime.HundredthSeconds,aTime.Seconds,aTime.Minutes,aTime.Hours,aDate.Day,aDate.Month,aDate.Year);
+        return DateTime(aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
+                        aDate.Day, aDate.Month, aDate.Year);
     }
 
     //-----------------------------------------------------------------------------
@@ -426,8 +461,8 @@ namespace dbtools
         sal_Int32 nIndex    = 0;
         sal_uInt16  nHour   = 0,
                     nMinute = 0,
-                    nSecond = 0,
-                    nHundredthSeconds   = 0;
+                    nSecond = 0;
+        sal_uInt32  nNanoSeconds = 0;
         nHour   = (sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32();
         if(nIndex != -1)
         {
@@ -437,17 +472,10 @@ namespace dbtools
                 nSecond = (sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32();
                 nIndex = 0;
                 OUString sNano(_sSQLString.getToken(1,'.',nIndex));
-                if ( !sNano.isEmpty() )
-                {
-                    // our time struct only supports hundredth seconds
-                    sNano = sNano.copy(0,::std::min<sal_Int32>(sNano.getLength(),2));
-                    const static OUString s_Zeros("00");
-                    sNano += s_Zeros.copy(0,s_Zeros.getLength() - sNano.getLength());
-                    nHundredthSeconds = static_cast<sal_uInt16>(sNano.toInt32());
-                }
+                nNanoSeconds = sNano.toInt32();
             }
         }
-        return Time(nHundredthSeconds,nSecond,nMinute,nHour);
+        return Time(nNanoSeconds, nSecond, nMinute, nHour);
     }
 
 //.........................................................................
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 1e37cc3..b509065 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -370,12 +370,12 @@ static void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& x
                 {
                     double fCellVal = xCell->getValue();
                     double fTime = fCellVal - rtl::math::approxFloor( fCellVal );
-                    long nIntTime = (long)rtl::math::round( fTime * 8640000.0 );
-                    if ( nIntTime == 8640000 )
-                        nIntTime = 0;                       // 23:59:59.995 and above is 00:00:00.00
+                    sal_Int64 nIntTime = static_cast<sal_Int64>(rtl::math::round( fTime * static_cast<double>(::Time::nanoSecPerDay) ));
+                    if ( nIntTime ==  ::Time::nanoSecPerDay)
+                        nIntTime = 0;                       // 23:59:59.9999999995 and above is 00:00:00.00
                     ::com::sun::star::util::Time aTime;
-                    aTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
-                    nIntTime /= 100;
+                    aTime.NanoSeconds = (sal_uInt32)( nIntTime % ::Time::nanoSecPerSec );
+                    nIntTime /= ::Time::nanoSecPerSec;
                     aTime.Seconds = (sal_uInt16)( nIntTime % 60 );
                     nIntTime /= 60;
                     aTime.Minutes = (sal_uInt16)( nIntTime % 60 );
@@ -394,17 +394,17 @@ static void lcl_SetValue( ORowSetValue& rValue, const Reference<XSpreadsheet>& x
                     double fDays = ::rtl::math::approxFloor( fCellVal );
                     double fTime = fCellVal - fDays;
                     long nIntDays = (long)fDays;
-                    long nIntTime = (long)::rtl::math::round( fTime * 8640000.0 );
-                    if ( nIntTime == 8640000 )
+                    sal_Int64 nIntTime = ::rtl::math::round( fTime * static_cast<double>(::Time::nanoSecPerDay) );
+                    if ( nIntTime == ::Time::nanoSecPerDay )
                     {
-                        nIntTime = 0;                       // 23:59:59.995 and above is 00:00:00.00
+                        nIntTime = 0;                       // 23:59:59.9999999995 and above is 00:00:00.00
                         ++nIntDays;                         // (next day)
                     }
 
                     ::com::sun::star::util::DateTime aDateTime;
 
-                    aDateTime.HundredthSeconds = (sal_uInt16)( nIntTime % 100 );
-                    nIntTime /= 100;
+                    aDateTime.NanoSeconds = (sal_uInt16)( nIntTime % ::Time::nanoSecPerSec );
+                    nIntTime /= ::Time::nanoSecPerSec;
                     aDateTime.Seconds = (sal_uInt16)( nIntTime % 60 );
                     nIntTime /= 60;
                     aDateTime.Minutes = (sal_uInt16)( nIntTime % 60 );
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 61f3c8d..7eef298 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -108,7 +108,7 @@ void lcl_CalcJulDate(sal_Int32& _nJulianDate,sal_Int32& _nJulianTime,const com::
         aDateTime.Month++;
     }
 
-    _nJulianTime = ((aDateTime.Hours*3600000)+(aDateTime.Minutes*60000)+(aDateTime.Seconds*1000)+(aDateTime.HundredthSeconds*10));
+    _nJulianTime = ((aDateTime.Hours*3600000)+(aDateTime.Minutes*60000)+(aDateTime.Seconds*1000)+(aDateTime.NanoSeconds/1000000));
     /* conversion factors */
     sal_uInt16 iy0;
     sal_uInt16 im0;
diff --git a/connectivity/source/drivers/file/FDateFunctions.cxx b/connectivity/source/drivers/file/FDateFunctions.cxx
index 03256f7..a24c46d 100644
--- a/connectivity/source/drivers/file/FDateFunctions.cxx
+++ b/connectivity/source/drivers/file/FDateFunctions.cxx
@@ -263,7 +263,7 @@ ORowSetValue OOp_CurTime::operate(const ::std::vector<ORowSetValue>& lhs) const
         return ORowSetValue();
 
     Time aCurTime( Time::SYSTEM );
-    return ::com::sun::star::util::Time(aCurTime.Get100Sec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour());
+    return ::com::sun::star::util::Time(aCurTime.GetNanoSec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour());
 }
 //------------------------------------------------------------------
 ORowSetValue OOp_Now::operate(const ::std::vector<ORowSetValue>& lhs) const
@@ -272,7 +272,7 @@ ORowSetValue OOp_Now::operate(const ::std::vector<ORowSetValue>& lhs) const
         return ORowSetValue();
 
     DateTime aCurTime( DateTime::SYSTEM );
-    return ::com::sun::star::util::DateTime(aCurTime.Get100Sec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour(),
+    return ::com::sun::star::util::DateTime(aCurTime.GetNanoSec(),aCurTime.GetSec(),aCurTime.GetMin(),aCurTime.GetHour(),
                                             aCurTime.GetDay(),aCurTime.GetMonth(),aCurTime.GetYear());
 }
 //------------------------------------------------------------------
diff --git a/connectivity/source/drivers/jdbc/ConnectionLog.cxx b/connectivity/source/drivers/jdbc/ConnectionLog.cxx
index 550db58..0216ad2 100644
--- a/connectivity/source/drivers/jdbc/ConnectionLog.cxx
+++ b/connectivity/source/drivers/jdbc/ConnectionLog.cxx
@@ -97,8 +97,8 @@ namespace comphelper { namespace log { namespace convert
     {
         char buffer[ 30 ];
         const size_t buffer_size = sizeof( buffer );
-        snprintf( buffer, buffer_size, "%02i:%02i:%02i.%02i",
-            (int)_rTime.Hours, (int)_rTime.Minutes, (int)_rTime.Seconds, (int)_rTime.HundredthSeconds );
+        snprintf( buffer, buffer_size, "%02i:%02i:%02i.%09i",
+            (int)_rTime.Hours, (int)_rTime.Minutes, (int)_rTime.Seconds, (int)_rTime.NanoSeconds );
         return OUString::createFromAscii( buffer );
     }
 
@@ -107,9 +107,9 @@ namespace comphelper { namespace log { namespace convert
     {
         char buffer[ 30 ];
         const size_t buffer_size = sizeof( buffer );
-        snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%02i",
+        snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%09i",
             (int)_rDateTime.Year, (int)_rDateTime.Month, (int)_rDateTime.Day,
-            (int)_rDateTime.Hours, (int)_rDateTime.Minutes, (int)_rDateTime.Seconds, (int)_rDateTime.HundredthSeconds );
+            (int)_rDateTime.Hours, (int)_rDateTime.Minutes, (int)_rDateTime.Seconds, (int)_rDateTime.NanoSeconds );
         return OUString::createFromAscii( buffer );
     }
 
diff --git a/connectivity/source/drivers/kab/KResultSet.cxx b/connectivity/source/drivers/kab/KResultSet.cxx
index 0ba7e01..faf61bc 100644
--- a/connectivity/source/drivers/kab/KResultSet.cxx
+++ b/connectivity/source/drivers/kab/KResultSet.cxx
@@ -344,7 +344,7 @@ DateTime SAL_CALL KabResultSet::getTimestamp(sal_Int32 columnIndex) throw(SQLExc
                 nRet.Hours = nRevision.time().hour();
                 nRet.Minutes = nRevision.time().minute();
                 nRet.Seconds = nRevision.time().second();
-                nRet.HundredthSeconds = nRevision.time().msec() / 10;
+                nRet.NanoSeconds = nRevision.time().msec() * ::Time::nanoPerMilli;
                 return nRet;
             }
         }
diff --git a/connectivity/source/drivers/macab/macabutilities.hxx b/connectivity/source/drivers/macab/macabutilities.hxx
index b6afd1c..a17bda2 100644
--- a/connectivity/source/drivers/macab/macabutilities.hxx
+++ b/connectivity/source/drivers/macab/macabutilities.hxx
@@ -92,7 +92,7 @@ namespace connectivity
             nRet.Hours = ptm->tm_hour;
             nRet.Minutes = ptm->tm_min;
             nRet.Seconds = ptm->tm_sec;
-            nRet.HundredthSeconds = 0;
+            nRet.NanoSeconds = 0;
             return nRet;
         }
 
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 4e5a113..fec060d 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -436,7 +436,7 @@ OUString SAL_CALL ODatabaseMetaDataResultSet::getString( sal_Int32 columnIndex )
         OTools::getValue(m_pConnection,m_aStatementHandle,columnIndex,m_pConnection->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP,m_bWasNull,**this,&aTime,sizeof aTime);
     else
         m_bWasNull = sal_True;
-    return DateTime((sal_uInt16)aTime.fraction/ODBC_FRACTION_UNITS_PER_HSECOND,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year);
+    return DateTime(aTime.fraction,aTime.second,aTime.minute,aTime.hour,aTime.day,aTime.month,aTime.year);
 }
 // -------------------------------------------------------------------------
 
diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
index 9cca190..5d234c4 100644
--- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
@@ -411,14 +411,27 @@ void SAL_CALL OPreparedStatement::setDate( sal_Int32 parameterIndex, const Date&
 
 void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time& aVal ) throw(SQLException, RuntimeException)
 {
-    const sal_uInt16 hundredths (aVal.HundredthSeconds);
     SQLULEN nColSize;
-    if(hundredths == 0)
+    if(aVal.NanoSeconds == 0)
         nColSize = 8;
-    else if(hundredths % 10 == 0)
+    else if(aVal.NanoSeconds % 100000000 == 0)
         nColSize = 10;
-    else
+    else if(aVal.NanoSeconds % 10000000 == 0)
         nColSize = 11;
+    else if(aVal.NanoSeconds % 1000000 == 0)
+        nColSize = 12;
+    else if(aVal.NanoSeconds % 100000 == 0)
+        nColSize = 13;
+    else if(aVal.NanoSeconds % 10000 == 0)
+        nColSize = 14;
+    else if(aVal.NanoSeconds % 1000 == 0)
+        nColSize = 15;
+    else if(aVal.NanoSeconds % 100 == 0)
+        nColSize = 16;
+    else if(aVal.NanoSeconds % 10 == 0)
+        nColSize = 17;
+    else
+        nColSize = 18;
     TIME_STRUCT x(OTools::TimeToOdbcTime(aVal));
     setScalarParameter<TIME_STRUCT&>(parameterIndex, DataType::TIME, nColSize, x);
 }
@@ -426,20 +439,32 @@ void SAL_CALL OPreparedStatement::setTime( sal_Int32 parameterIndex, const Time&
 
 void SAL_CALL OPreparedStatement::setTimestamp( sal_Int32 parameterIndex, const DateTime& aVal ) throw(SQLException, RuntimeException)
 {
-    sal_uInt16 s(aVal.Seconds);
-    sal_uInt16 hundredths(aVal.HundredthSeconds);
     SQLULEN nColSize;
-    if(hundredths == 0)
+    if(aVal.NanoSeconds == 0)
     {
-        if (s == 0)
+        if (aVal.Seconds == 0)
             nColSize=16;
         else
             nColSize=19;
     }
-    else if(hundredths % 10 == 0)
+    else if(aVal.NanoSeconds % 100000000 == 0)
         nColSize = 21;
-    else
+    else if(aVal.NanoSeconds % 10000000 == 0)
         nColSize = 22;
+    else if(aVal.NanoSeconds % 1000000 == 0)
+        nColSize = 23;
+    else if(aVal.NanoSeconds % 100000 == 0)
+        nColSize = 24;
+    else if(aVal.NanoSeconds % 10000 == 0)
+        nColSize = 25;
+    else if(aVal.NanoSeconds % 1000 == 0)
+        nColSize = 26;
+    else if(aVal.NanoSeconds % 100 == 0)
+        nColSize = 27;
+    else if(aVal.NanoSeconds % 10 == 0)
+        nColSize = 28;
+    else
+        nColSize = 29;
 
     TIMESTAMP_STRUCT x(OTools::DateTimeToTimestamp(aVal));
     setScalarParameter<TIMESTAMP_STRUCT&>(parameterIndex, DataType::TIMESTAMP, nColSize, x);
diff --git a/connectivity/source/drivers/odbcbase/OResultSet.cxx b/connectivity/source/drivers/odbcbase/OResultSet.cxx
index dcc7c88..211ba70 100644
--- a/connectivity/source/drivers/odbcbase/OResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/OResultSet.cxx
@@ -663,7 +663,7 @@ DateTime OResultSet::impl_getTimestamp( sal_Int32 columnIndex ) throw(SQLExcepti
     TIMESTAMP_STRUCT aTime = impl_getValue< TIMESTAMP_STRUCT > ( columnIndex,
                                                                  m_pStatement->getOwnConnection()->useOldDateFormat() ? SQL_C_TIMESTAMP : SQL_C_TYPE_TIMESTAMP );
 
-    return DateTime(static_cast<sal_uInt16>(aTime.fraction/ODBC_FRACTION_UNITS_PER_HSECOND),
+    return DateTime(aTime.fraction,
                     aTime.second,
                     aTime.minute,
                     aTime.hour,
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index ccce76f..a9be424 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -107,6 +107,7 @@ namespace pq_sdbc_driver
 
 OUString date2String( const com::sun::star::util::Date & x )
 {
+    // TODO FIXME: replace by DBTypeConversion::toDateString
     char buffer[64];
     sprintf( buffer, "%d-%02d-%02d", x.Year, x.Month, x.Day );
     return OUString::createFromAscii( buffer );
@@ -114,6 +115,7 @@ OUString date2String( const com::sun::star::util::Date & x )
 
 com::sun::star::util::Date string2Date( const  OUString &date )
 {
+    // TODO FIXME: replace by DBTypeConversion::toDate (if it parses the same format)
     // Format: Year-Month-Day
     com::sun::star::util::Date ret;
 
@@ -135,15 +137,17 @@ com::sun::star::util::Date string2Date( const  OUString &date )
 
 OUString time2String( const com::sun::star::util::Time & x )
 {
-    char buffer[64];
-    sprintf( buffer, "%02d:%02d:%02d.%02d", x.Hours, x.Minutes, x.Seconds, x.HundredthSeconds );
+    // TODO FIXME: replace by DBTypeConversion::toTimeString
+    const size_t buflen = 19;
+    char buffer[buflen];
+    snprintf( buffer, buflen, "%02d:%02d:%02d.%09d", x.Hours, x.Minutes, x.Seconds, x.NanoSeconds );
     return OUString::createFromAscii( buffer );
-
 }
 
 
 com::sun::star::util::Time string2Time( const OUString & time )
 {
+    // TODO FIXME: replace by DBTypeConversion::toTime
     com::sun::star::util::Time ret;
 
     sal_Unicode temp[4];
@@ -163,7 +167,8 @@ com::sun::star::util::Time string2Time( const OUString & time )
 
     if( time.getLength() >9 )
     {
-        ret.HundredthSeconds = (sal_Int32)rtl_ustr_toInt32( &time.getStr()[9] , 10 );
+        // FIXME does not take into account shorter precision
+        ret.NanoSeconds = (sal_Int32)rtl_ustr_toInt32( &time.getStr()[9] , 10 );
     }
     return ret;
 
@@ -173,16 +178,18 @@ com::sun::star::util::Time string2Time( const OUString & time )
 
 OUString dateTime2String( const com::sun::star::util::DateTime & x )
 {
+    // TODO FIXME: replace by DBTypeConversion::toDateTimeString
     char buffer[128];
-    sprintf( buffer, "%d-%02d-%02d %02d:%02d:%02d.%02d",
+    sprintf( buffer, "%d-%02d-%02d %02d:%02d:%02d.%09d",
              x.Year, x.Month, x.Day,
-             x.Hours, x.Minutes, x.Seconds, x.HundredthSeconds );
+             x.Hours, x.Minutes, x.Seconds, x.NanoSeconds );
     return OUString::createFromAscii( buffer );
 
 }
 
 com::sun::star::util::DateTime string2DateTime( const OUString & dateTime )
 {
+    // TODO FIXME: replace by DBTypeConversion::toDateTime (if same format)
     int space = dateTime.indexOf( ' ' );
     com::sun::star::util::DateTime ret;
 
@@ -197,7 +204,7 @@ com::sun::star::util::DateTime string2DateTime( const OUString & dateTime )
         ret.Hours = time.Hours;
         ret.Minutes = time.Minutes;
         ret.Seconds = time.Seconds;
-        ret.HundredthSeconds = time.HundredthSeconds;
+        ret.NanoSeconds = time.NanoSeconds;
     }
     return ret;
 }
diff --git a/connectivity/source/inc/odbc/OTools.hxx b/connectivity/source/inc/odbc/OTools.hxx
index 79be84c..015e5f2 100644
--- a/connectivity/source/inc/odbc/OTools.hxx
+++ b/connectivity/source/inc/odbc/OTools.hxx
@@ -91,7 +91,6 @@ namespace connectivity
     {
         class OConnection;
 
-        const sal_uInt32 ODBC_FRACTION_UNITS_PER_HSECOND = 10000000L;
         const sal_Int32 MAX_PUT_DATA_LENGTH = 2000;
 
         class OOO_DLLPUBLIC_ODBCBASE OTools
@@ -166,7 +165,7 @@ namespace connectivity
                 aVal.hour       = x.Hours;
                 aVal.minute     = x.Minutes;
                 aVal.second     = x.Seconds;
-                aVal.fraction   = x.HundredthSeconds * ODBC_FRACTION_UNITS_PER_HSECOND;
+                aVal.fraction   = x.NanoSeconds;
                 return aVal;
             }
             /**
diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 0f4e2ae..bc67903 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -85,7 +85,7 @@ SvxFieldData* SvxFieldData::Create(const uno::Reference<text::XTextContent>& xTe
             if (nFieldType != text::textfield::Type::TIME && nFieldType != text::textfield::Type::DATE)
             {
                 util::DateTime aDateTime = xPropSet->getPropertyValue(UNO_TC_PROP_DATE_TIME).get<util::DateTime>();
-                Time aTime(aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.HundredthSeconds);
+                Time aTime(aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.NanoSeconds);
 
                 sal_Bool bIsFixed = false;
                 xPropSet->getPropertyValue(UNO_TC_PROP_IS_FIXED) >>= bIsFixed;
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index 9aa5b0b..86a039b 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -208,7 +208,7 @@ static util::DateTime getTime( long nTime )
 
     Time aTempTime( nTime );
 
-    aTime.HundredthSeconds = aTempTime.Get100Sec();
+    aTime.NanoSeconds = aTempTime.GetNanoSec();
     aTime.Seconds = aTempTime.GetSec();
     aTime.Minutes = aTempTime.GetMin();
     aTime.Hours = aTempTime.GetHour();
@@ -218,7 +218,7 @@ static util::DateTime getTime( long nTime )
 
 inline Time setTime( util::DateTime& rDate )
 {
-    return Time( rDate.Hours, rDate.Minutes, rDate.Seconds, rDate.HundredthSeconds  );
+    return Time( rDate.Hours, rDate.Minutes, rDate.Seconds, rDate.NanoSeconds  );
 }
 
 // ====================================================================
diff --git a/extensions/source/logging/csvformatter.cxx b/extensions/source/logging/csvformatter.cxx
index 19b2a2b..7bf5188 100644
--- a/extensions/source/logging/csvformatter.cxx
+++ b/extensions/source/logging/csvformatter.cxx
@@ -263,14 +263,14 @@ namespace logging
             // ISO 8601
             char buffer[ 30 ];
             const size_t buffer_size = sizeof( buffer );
-            snprintf( buffer, buffer_size, "%04i-%02i-%02iT%02i:%02i:%02i.%02i",
+            snprintf( buffer, buffer_size, "%04i-%02i-%02iT%02i:%02i:%02i.%09i",
                 (int)record.LogTime.Year,
                 (int)record.LogTime.Month,
                 (int)record.LogTime.Day,
                 (int)record.LogTime.Hours,
                 (int)record.LogTime.Minutes,
                 (int)record.LogTime.Seconds,
-                (int)record.LogTime.HundredthSeconds );
+                (int)record.LogTime.NanoSeconds );
             aLogEntry.appendAscii( buffer );
             aLogEntry.append(comma_char);
         }
diff --git a/extensions/source/logging/logrecord.cxx b/extensions/source/logging/logrecord.cxx
index ce9c8ba..dfd0cb8 100644
--- a/extensions/source/logging/logrecord.cxx
+++ b/extensions/source/logging/logrecord.cxx
@@ -68,7 +68,7 @@ namespace logging
         aTimeStamp.Hours = aDateTime.Hours;
         aTimeStamp.Minutes = aDateTime.Minutes;
         aTimeStamp.Seconds = aDateTime.Seconds;
-        aTimeStamp.HundredthSeconds = ::sal::static_int_cast< sal_Int16 >( aDateTime.NanoSeconds / 10000000 );
+        aTimeStamp.NanoSeconds = aDateTime.NanoSeconds;
 
         return LogRecord(
             _rLoggerName,
diff --git a/extensions/source/logging/plaintextformatter.cxx b/extensions/source/logging/plaintextformatter.cxx
index 7396263..7ce4875 100644
--- a/extensions/source/logging/plaintextformatter.cxx
+++ b/extensions/source/logging/plaintextformatter.cxx
@@ -129,9 +129,9 @@ namespace logging
         aLogEntry.appendAscii( buffer );
         aLogEntry.appendAscii( " " );
 
-        snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%02i",
+        snprintf( buffer, buffer_size, "%04i-%02i-%02i %02i:%02i:%02i.%09i",
             (int)_rRecord.LogTime.Year, (int)_rRecord.LogTime.Month, (int)_rRecord.LogTime.Day,
-            (int)_rRecord.LogTime.Hours, (int)_rRecord.LogTime.Minutes, (int)_rRecord.LogTime.Seconds, (int)_rRecord.LogTime.HundredthSeconds );
+            (int)_rRecord.LogTime.Hours, (int)_rRecord.LogTime.Minutes, (int)_rRecord.LogTime.Seconds, (int)_rRecord.LogTime.NanoSeconds );
         aLogEntry.appendAscii( buffer );
         aLogEntry.appendAscii( " " );
 
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index 2b68425..773a4e6 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -590,7 +590,7 @@ namespace pcr
         {
             util::Time aTime;
             OSL_VERIFY( _rControlValue >>= aTime );
-            aPropertyValue <<= (sal_Int32)DBTypeConversion::toINT32( aTime );
+            aPropertyValue <<= DBTypeConversion::toINT64( aTime );
         }
         break;
 
@@ -726,7 +726,7 @@ namespace pcr
         case PROPERTY_ID_DEFAULT_TIME:
         case PROPERTY_ID_TIME:
         {
-            sal_Int32 nTime = 0;
+            sal_Int64 nTime = 0;
             OSL_VERIFY( _rPropertyValue >>= nTime );
             aControlValue <<= DBTypeConversion::toTime( nTime );
         }
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index f9caaae..60f533a 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -87,7 +87,7 @@ namespace pcr
         }
         else
         {
-            ::Time aTime( aUNOTime.Hours, aUNOTime.Minutes, aUNOTime.Seconds, aUNOTime.HundredthSeconds );
+            ::Time aTime( aUNOTime.Hours, aUNOTime.Minutes, aUNOTime.Seconds, aUNOTime.NanoSeconds );
             getTypedControlWindow()->SetTime( aTime );
         }
     }
@@ -99,7 +99,7 @@ namespace pcr
         if ( !getTypedControlWindow()->GetText().isEmpty() )
         {
             ::Time aTime( getTypedControlWindow()->GetTime() );
-            util::Time aUNOTime( aTime.Get100Sec(), aTime.GetSec(), aTime.GetMin(), aTime.GetHour() );
+            util::Time aUNOTime( aTime.GetNanoSec(), aTime.GetSec(), aTime.GetMin(), aTime.GetHour() );
             aPropValue <<= aUNOTime;
         }
         return aPropValue;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 104db58..b8b680b 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -118,6 +118,7 @@
 #include <algorithm>
 #include <set>
 #include <rtl/strbuf.hxx>
+#include <tools/time.hxx>
 
 // PPT ColorScheme Slots
 #define PPT_COLSCHEME                       (0x08000000)
@@ -2673,11 +2674,11 @@ void ImportComment10( SvxMSDffManager& rMan, SvStream& rStCtrl, SdrPage* pPage,
                         >> aDateTime.Hours
                         >> aDateTime.Minutes
                         >> aDateTime.Seconds
-                        >> aDateTime.HundredthSeconds
+                        >> aDateTime.NanoSeconds
                         >> nPosX
                         >> nPosY;
 
-                aDateTime.HundredthSeconds /= 10;
+                aDateTime.NanoSeconds *= ::Time::nanoPerMilli;
             }
             break;
         }
diff --git a/forms/qa/integration/forms/TimeValidator.java b/forms/qa/integration/forms/TimeValidator.java
index ab9f036..36d1ae8 100644
--- a/forms/qa/integration/forms/TimeValidator.java
+++ b/forms/qa/integration/forms/TimeValidator.java
@@ -70,11 +70,11 @@ public class TimeValidator extends integration.forms.ControlValidator
 
     private boolean isInvalidTime( com.sun.star.util.Time timeValue )
     {
-        return ( timeValue.Hours == -1 ) && ( timeValue.Minutes == -1 ) && ( timeValue.Seconds == -1 ) && ( timeValue.HundredthSeconds == -1 );
+        return ( timeValue.Hours == -1 ) && ( timeValue.Minutes == -1 ) && ( timeValue.Seconds == -1 ) && ( timeValue.NanoSeconds == -1 );
     }
 
     private boolean isFullHour( com.sun.star.util.Time timeValue )
     {
-        return ( timeValue.Minutes == 0 ) && ( timeValue.Seconds == 0 ) && ( timeValue.HundredthSeconds == 0 );
+        return ( timeValue.Minutes == 0 ) && ( timeValue.Seconds == 0 ) && ( timeValue.NanoSeconds == 0 );
     }
 }
diff --git a/forms/source/component/Time.cxx b/forms/source/component/Time.cxx
index 7b7b56c..420a317 100644
--- a/forms/source/component/Time.cxx
+++ b/forms/source/component/Time.cxx
@@ -246,7 +246,7 @@ sal_Bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
                 util::Time aTime;
                 if ( !( aControlValue >>= aTime ) )
                 {
-                    sal_Int32 nAsInt(0);
+                    sal_Int64 nAsInt(0);
                     aControlValue >>= nAsInt;
                     aTime = DBTypeConversion::toTime(nAsInt);
                 }
@@ -256,7 +256,7 @@ sal_Bool OTimeModel::commitControlValueToDbColumn( bool /*_bPostReset*/ )
                 else
                 {
                     util::DateTime aDateTime = m_xColumn->getTimestamp();
-                    aDateTime.HundredthSeconds = aTime.HundredthSeconds;
+                    aDateTime.NanoSeconds = aTime.NanoSeconds;
                     aDateTime.Seconds = aTime.Seconds;
                     aDateTime.Minutes = aTime.Minutes;
                     aDateTime.Hours = aTime.Hours;
@@ -279,7 +279,7 @@ void OTimeModel::impl_translateControlValueToUNOTime( Any& _rUNOValue ) const
     _rUNOValue = getControlValue();
     if ( _rUNOValue.hasValue() )
     {
-        sal_Int32 nTime = 0;
+        sal_Int64 nTime = 0;
         OSL_VERIFY( _rUNOValue >>= nTime );
         if ( nTime == ::Time( 99, 99, 99 ).GetTime() )
             // "invalid time" in VCL is different from "invalid time" in UNO
@@ -305,7 +305,7 @@ Any OTimeModel::translateExternalValueToControlValue( const Any& _rExternalValue
     {
         util::Time aTime;
         OSL_VERIFY( _rExternalValue >>= aTime );
-        aControlValue <<= DBTypeConversion::toINT32( aTime );
+        aControlValue <<= DBTypeConversion::toINT64( aTime );
     }
     return aControlValue;
 }
@@ -325,8 +325,9 @@ Any OTimeModel::translateDbColumnToControlValue()
     if ( m_xColumn->wasNull() )
         m_aSaveValue.clear();
     else
-        // the aggregated set expects an Int32 as value ...
-        m_aSaveValue <<= DBTypeConversion::toINT32( aTime );
+        // TODO FIXME: "the aggregated set expects an Int32 as value ..."
+        //             need to fix it for int64
+        m_aSaveValue <<= DBTypeConversion::toINT64( aTime );
 
     return m_aSaveValue;
 }
diff --git a/forms/source/xforms/convert.cxx b/forms/source/xforms/convert.cxx
index b440f4b..6dac929 100644
--- a/forms/source/xforms/convert.cxx
+++ b/forms/source/xforms/convert.cxx
@@ -33,13 +33,14 @@
 #include <com/sun/star/util/Date.hpp>
 #include <com/sun/star/util/DateTime.hpp>
 #include <com/sun/star/util/Time.hpp>
+#include <unotools/datetime.hxx>
 
 using xforms::Convert;
 using com::sun::star::uno::Any;
 using com::sun::star::uno::makeAny;
-using com::sun::star::util::Time;
 using namespace std;
 using namespace o3tl;
+using namespace utl;
 
 typedef com::sun::star::util::Date UNODate;
 typedef com::sun::star::util::Time UNOTime;
@@ -279,30 +280,7 @@ namespace
 
         UNODate aDate( 1, 1, 1900 );
 
-        sal_Int32 nToken = 0;
-        StringTokenizer aTokenizer( rString, '-' );
-        while ( aTokenizer.hasNextToken() )
-        {
-            sal_Int32 nTokenValue = 0;
-            if ( !aTokenizer.getNextToken().toInt32( nTokenValue ) )
-            {
-                bWellformed = false;
-                break;
-            }
-
-            if ( nToken == 0 )
-                aDate.Year = (sal_uInt16)nTokenValue;
-            else if ( nToken == 1 )
-                aDate.Month = (sal_uInt16)nTokenValue;
-            else if ( nToken == 2 )
-                aDate.Day = (sal_uInt16)nTokenValue;
-            else
-            {
-                bWellformed = false;
-                break;
-            }
-            ++nToken;
-        }
+        bWellformed = ISO8601parseDate(rString, aDate);
 
         // sanity checks
         if ( ( aDate.Year > 9999 ) || ( aDate.Month < 1 ) || ( aDate.Month > 12 ) || ( aDate.Day < 1 ) || ( aDate.Day > 31 ) )
@@ -337,10 +315,15 @@ namespace
         lcl_appendInt32ToBuffer( rTime.Minutes, sInfo, 2 );
         sInfo.appendAscii( ":" );
         lcl_appendInt32ToBuffer( rTime.Seconds, sInfo, 2 );
-        if ( rTime.HundredthSeconds )
+        if ( rTime.NanoSeconds != 0 )
         {
-            sInfo.appendAscii( "." );
-            lcl_appendInt32ToBuffer( rTime.HundredthSeconds, sInfo, 2 );
+            OSL_ENSURE(rTime.NanoSeconds < 1000000000,"NanoSeconds cannot be more than 999 999 999");
+            sInfo.append('.');
+            std::ostringstream ostr;
+            ostr.fill('0');
+            ostr.width(9);
+            ostr << rTime.NanoSeconds;
+            sInfo.append(OUString::createFromAscii(ostr.str().c_str()));
         }
 
         return sInfo.makeStringAndClear();
@@ -361,62 +344,7 @@ namespace
 
         UNOTime aTime( 0, 0, 0, 0 );
 
-        OUString sString( rString );
-        // see if there's a decimal separator for the seconds,
-        // and if so, handle it separately
-        sal_Int32 nDecimalSepPos = rString.indexOf( '.' );
-        if ( nDecimalSepPos == -1 )
-            // ISO 8601 allows for both a comma and a dot
-            nDecimalSepPos = rString.indexOf( ',' );
-        if ( nDecimalSepPos != -1 )
-        {
-            // handle fractional seconds
-            OUString sFractional = sString.copy( nDecimalSepPos + 1 );
-            if ( sFractional.getLength() > 2 )
-                // our precision is HundrethSeconds - it's all a css.util.Time can hold
-                sFractional = sFractional.copy( 0, 2 );
-            if ( !sFractional.isEmpty() )
-            {
-                sal_Int32 nFractional = 0;
-                if ( StringTokenizer( sFractional, 0 ).getNextToken().toInt32( nFractional ) )
-                {
-                    aTime.HundredthSeconds = (sal_uInt16)nFractional;
-                    if ( nFractional < 10 )
-                        aTime.HundredthSeconds *= 10;
-                }
-                else
-                    bWellformed = false;
-            }
-
-            // strip the fraction before further processing
-            sString = sString.copy( 0, nDecimalSepPos );
-        }
-
-        // split into the tokens which are separated by colon
-        sal_Int32 nToken = 0;
-        StringTokenizer aTokenizer( sString, ':' );
-        while ( aTokenizer.hasNextToken() )
-        {
-            sal_Int32 nTokenValue = 0;
-            if ( !aTokenizer.getNextToken().toInt32( nTokenValue ) )
-            {
-                bWellformed = false;
-                break;
-            }
-
-            if ( nToken == 0 )
-                aTime.Hours = (sal_uInt16)nTokenValue;
-            else if ( nToken == 1 )
-                aTime.Minutes = (sal_uInt16)nTokenValue;
-            else if ( nToken == 2 )
-                aTime.Seconds = (sal_uInt16)nTokenValue;
-            else
-            {
-                bWellformed = false;
-                break;
-            }
-            ++nToken;
-        }
+        bWellformed = ISO8601parseTime(rString, aTime);
 
         // sanity checks
         // note that Seconds == 60 denotes leap seconds. Normally, they're not allowed everywhere,
@@ -431,7 +359,7 @@ namespace
             &&  ( aTime.Hours == 24 )
             &&  (   ( aTime.Minutes != 0 )
                 ||  ( aTime.Seconds != 0 )
-                ||  ( aTime.HundredthSeconds != 0 )
+                ||  ( aTime.NanoSeconds != 0 )
                 )
             )
             bWellformed = false;
@@ -458,7 +386,7 @@ namespace
         UNODate aDate( aDateTime.Day, aDateTime.Month, aDateTime.Year );
         OUString sDate = lcl_toXSD_UNODate_typed( aDate );
 
-        UNOTime aTime( aDateTime.HundredthSeconds, aDateTime.Seconds, aDateTime.Minutes, aDateTime.Hours );
+        UNOTime aTime( aDateTime.NanoSeconds, aDateTime.Seconds, aDateTime.Minutes, aDateTime.Hours );
         OUString sTime = lcl_toXSD_UNOTime_typed( aTime );
 
         OUStringBuffer sInfo;
@@ -489,7 +417,7 @@ namespace
             aTime = lcl_toUNOTime( rString.copy( nDateTimeSep + 1 ) );
         }
         UNODateTime aDateTime(
-            aTime.HundredthSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
+            aTime.NanoSeconds, aTime.Seconds, aTime.Minutes, aTime.Hours,
             aDate.Day, aDate.Month, aDate.Year
         );
         return makeAny( aDateTime );
diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx
index e1fcdeb..66dbd90 100644
--- a/forms/source/xforms/datatypes.cxx
+++ b/forms/source/xforms/datatypes.cxx
@@ -829,7 +829,14 @@ namespace xforms
         if ( !( aTypedValue >>= aValue ) )
             return false;
 
-        ::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.HundredthSeconds );
+        ::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds );
+        // no loss/rounding; IEEE 754 double-precision floating-point
+        // has a mantissa of 53 bits; we need at the very most 50 bits:
+        // format of aToolsTime.GetTime() is (in decimal) hhmmssnnnnnnnnn
+        // and 999999999999999 = 0x38D7EA4C67FFF
+        // in reality I doubt we need (much) more than
+        //     240000000000000 = 0x0DA475ABF0000
+        // that is 48 bits
         fValue = aToolsTime.GetTime();
         return true;
     }
@@ -846,7 +853,7 @@ namespace xforms
     {
         Time aValue;
         OSL_VERIFY( _rValue >>= aValue );
-        ::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.HundredthSeconds );
+        ::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds );
         _rDoubleValue = aToolsTime.GetTime();
     }
 
@@ -869,7 +876,7 @@ namespace xforms
         {
             ::DateTime aToolsValue(
                 ::Date( _rValue.Day, _rValue.Month, _rValue.Year ),
-                ::Time( _rValue.Hours, _rValue.Minutes, _rValue.Seconds, _rValue.HundredthSeconds )
+                ::Time( _rValue.Hours, _rValue.Minutes, _rValue.Seconds, _rValue.NanoSeconds )
             );
 
             double fValue = 0;
diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx
index a39114d..051fd7a 100644
--- a/framework/source/jobs/jobdata.cxx
+++ b/framework/source/jobs/jobdata.cxx
@@ -567,6 +567,7 @@ sal_Bool isEnabled( const OUString& sAdminTime ,
 
     // We check for "isEnabled()" here only.
     // Note further: ISO8601 formated strings can be compared as strings directly!
+    //               FIXME: this is not true! "T1215" is the same time as "T12:15" or "T121500"
     return (
             (!bValidAdmin && !bValidUser                         ) ||
             ( bValidAdmin &&  bValidUser && sAdminTime>=sUserTime)
diff --git a/odk/examples/DevelopersGuide/Forms/TimeValidator.java b/odk/examples/DevelopersGuide/Forms/TimeValidator.java
index 8104229..333e7c9 100644
--- a/odk/examples/DevelopersGuide/Forms/TimeValidator.java
+++ b/odk/examples/DevelopersGuide/Forms/TimeValidator.java
@@ -70,11 +70,11 @@ public class TimeValidator extends ControlValidator
 
     private boolean isInvalidTime( com.sun.star.util.Time timeValue )
     {
-        return ( timeValue.Hours == -1 ) && ( timeValue.Minutes == -1 ) && ( timeValue.Seconds == -1 ) && ( timeValue.HundredthSeconds == -1 );
+        return ( timeValue.Hours == -1 ) && ( timeValue.Minutes == -1 ) && ( timeValue.Seconds == -1 ) && ( timeValue.NanoSeconds == -1 );
     }
 
     private boolean isFullHour( com.sun.star.util.Time timeValue )
     {
-        return ( timeValue.Minutes == 0 ) && ( timeValue.Seconds == 0 ) && ( timeValue.HundredthSeconds == 0 );
+        return ( timeValue.Minutes == 0 ) && ( timeValue.Seconds == 0 ) && ( timeValue.NanoSeconds == 0 );
     }
 }
diff --git a/offapi/com/sun/star/util/Date.idl b/offapi/com/sun/star/util/Date.idl
index d881fd4..ecbda5a 100644
--- a/offapi/com/sun/star/util/Date.idl
+++ b/offapi/com/sun/star/util/Date.idl
@@ -40,7 +40,7 @@ published struct Date
 
     /** contains the year.
      */
-    unsigned short Year;
+    short Year;
 
 };
 
diff --git a/offapi/com/sun/star/util/DateTime.idl b/offapi/com/sun/star/util/DateTime.idl
index 11f672b..312589f 100644
--- a/offapi/com/sun/star/util/DateTime.idl
+++ b/offapi/com/sun/star/util/DateTime.idl
@@ -28,10 +28,9 @@ module com {  module sun {  module star {  module util {
  */
 published struct DateTime
 {
-    /** contains the hundredth seconds (0-99).
+    /** contains the nanoseconds (0 - 999 999 999).
      */
-    unsigned short HundredthSeconds;
-
+    unsigned long NanoSeconds;
 
     /** contains the seconds (0-59).
      */
@@ -60,7 +59,9 @@ published struct DateTime
 
     /** is the year.
      */
-    unsigned short Year;
+    short Year;
+
+    /** TODO: timezone **/
 
 };
 
diff --git a/offapi/com/sun/star/util/DateTimeRange.idl b/offapi/com/sun/star/util/DateTimeRange.idl
index 94e005a..b56a048 100644
--- a/offapi/com/sun/star/util/DateTimeRange.idl
+++ b/offapi/com/sun/star/util/DateTimeRange.idl
@@ -28,9 +28,9 @@ module com {  module sun {  module star {  module util {
  */
 published struct DateTimeRange
 {
-    /** contains the start hundredth seconds (0-99) for the range.
+    /** contains the start nanoseconds (0 - 999 999 999) for the range.
      */
-    unsigned short StartHundredthSeconds;
+    unsigned long StartNanoSeconds;
 
     /** contains the start seconds (0-59) for the range.
      */
@@ -54,11 +54,11 @@ published struct DateTimeRange
 
     /** contains the start year for the range.
      */
-    unsigned short StartYear;
+    short StartYear;
 
-    /** contains the end hundredth seconds (0-99) for the range.
+    /** contains the end nanoseconds (0 - 999 999 999) for the range.
      */
-    unsigned short EndHundredthSeconds;
+    unsigned long EndNanoSeconds;
 
     /** contains the end seconds (0-59) for the range.
      */
@@ -82,8 +82,9 @@ published struct DateTimeRange
 
     /** contains the end year for the range.
      */
-    unsigned short EndYear;
+    short EndYear;
 
+    /** TODO timezones **/
 };
 
 
diff --git a/offapi/com/sun/star/util/Duration.idl b/offapi/com/sun/star/util/Duration.idl
index 6b373dd..519e837 100644
--- a/offapi/com/sun/star/util/Duration.idl
+++ b/offapi/com/sun/star/util/Duration.idl
@@ -69,9 +69,9 @@ struct Duration
      */
     unsigned short Seconds;
 
-    /** contains the milliseconds.
+    /** contains the nanoseconds.
      */
-    unsigned short MilliSeconds;
+    unsigned long NanoSeconds;
 
 };
 
diff --git a/offapi/com/sun/star/util/Time.idl b/offapi/com/sun/star/util/Time.idl
index 51cbd7e..1ac850f 100644
--- a/offapi/com/sun/star/util/Time.idl
+++ b/offapi/com/sun/star/util/Time.idl
@@ -28,9 +28,9 @@ module com {  module sun {  module star {  module util {
  */
 published struct Time
 {
-    /** contains the hundredth seconds (0-99).
+    /** contains the nanoseconds (0 - 999 999 999).
      */
-    unsigned short HundredthSeconds;
+    unsigned long NanoSeconds;
 
     /** contains the seconds (0-59).
      */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index f43806a..ecd1b60 100644
Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 73d223e..28d47c2 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -482,10 +482,12 @@ writeElement( FSHelperPtr pDoc, sal_Int32 nXmlElement, const util::DateTime& rTi
                 FSEND );
 
     char pStr[200];
-    snprintf( pStr, sizeof( pStr ), "%d-%02d-%02dT%02d:%02d:%02d.%02dZ",
+    // FIXME: my guess is that precision greater than millisecond in undesirable
+    //        (forbidden by the standard???)
+    snprintf( pStr, sizeof( pStr ), "%d-%02d-%02dT%02d:%02d:%02d.%09dZ",
             rTime.Year, rTime.Month, rTime.Day,
             rTime.Hours, rTime.Minutes, rTime.Seconds,
-            rTime.HundredthSeconds );
+            rTime.NanoSeconds);
 
     pDoc->write( pStr );
 
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index dfa19ba..867a66f 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -2285,11 +2285,11 @@ util::DateTime InputObjectBase::dumpFileTime( const String& rName )
     }
     // the day
     aDateTime.Day = static_cast< sal_uInt16 >( nDaysInYear + 1 );
-    // number of 1/100 seconds in the day
-    sal_Int64 nTimeInDay = nFileTime % sal_Int64( 360000 * 24 );
-    // 1/100 seconds
-    aDateTime.HundredthSeconds = static_cast< sal_uInt16 >( nTimeInDay % 100 );
-    nTimeInDay /= 100;
+    // number of nanoseconds in the day
+    sal_Int64 nTimeInDay = nFileTime % sal_Int64( 86400000000000 );
+    // nanoseconds
+    aDateTime.NanoSeconds = static_cast< sal_uInt32 >( nTimeInDay % 1000000000 );
+    nTimeInDay /= 1000000000;
     // seconds
     aDateTime.Seconds = static_cast< sal_uInt16 >( nTimeInDay % 60 );
     nTimeInDay /= 60;
diff --git a/oox/source/ppt/comments.cxx b/oox/source/ppt/comments.cxx
index 26725ff..bf598c7 100644
--- a/oox/source/ppt/comments.cxx
+++ b/oox/source/ppt/comments.cxx
@@ -9,6 +9,7 @@
 
 #include "oox/ppt/comments.hxx"
 #include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <rtl/math.hxx>
 
 
 namespace oox { namespace ppt {
@@ -37,7 +38,28 @@ void Comment::setDateTime (OUString datetime)
     datetime = datetime.getToken(1,'T');
     aDateTime.Hours = datetime.getToken(0,':').toInt32();
     aDateTime.Minutes = datetime.getToken(1,':').toInt32();
-    aDateTime.HundredthSeconds = int(datetime.getToken(2,':').toDouble() + .5);
+    double seconds = datetime.getToken(2,':').toDouble();
+    aDateTime.Seconds = floor(seconds);
+    seconds -= aDateTime.Seconds;
+    aDateTime.NanoSeconds = ::rtl::math::round(seconds * 1000000000);
+    const int secondsOverFlow = (aDateTime.Seconds == 60) ? 61 : 60;
+    // normalise time part of aDateTime
+    if (aDateTime.NanoSeconds == 1000000000)
+    {
+        aDateTime.NanoSeconds = 0;
+        ++aDateTime.Seconds;
+    }
+    if (aDateTime.Seconds == secondsOverFlow)
+    {
+        aDateTime.Seconds = 0;
+        ++aDateTime.Minutes;
+    }
+    if (aDateTime.Minutes == 60)
+    {
+        aDateTime.Minutes = 0;
+        ++aDateTime.Hours;
+    }
+    // if overflow goes into date, I give up
 }
 
 OUString Comment::getAuthor ( const CommentAuthorList& list )
diff --git a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
index 3b9bd82..9c884d9 100644
--- a/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
+++ b/qadevOOo/tests/java/mod/_forms/ODatabaseForm.java
@@ -636,11 +636,11 @@ public class ODatabaseForm extends TestCase {
         d.Day = 26; d.Month = 1; d.Year = 2001;
         params.add(d) ;
         Time t = new Time();
-        t.Hours = 1; t.HundredthSeconds = 12; t.Minutes = 25; t.Seconds = 14;
+        t.Hours = 1; t.NanoSeconds = 123456789; t.Minutes = 25; t.Seconds = 14;
         params.add(t) ;
         DateTime dt = new DateTime();
         dt.Day = 26; dt.Month = 1; dt.Year = 2001; dt.Hours = 1;
-        dt.HundredthSeconds = 12; dt.Minutes = 25; dt.Seconds = 14;
+        dt.NanoSeconds = 123456789; dt.Minutes = 25; dt.Seconds = 14;
         params.add(dt) ;
         tEnv.addObjRelation("XParameters.ParamValues", params);
 
diff --git a/reportbuilder/java/org/libreoffice/report/SDBCReportData.java b/reportbuilder/java/org/libreoffice/report/SDBCReportData.java
index 6019d94..c05d6b8 100644
--- a/reportbuilder/java/org/libreoffice/report/SDBCReportData.java
+++ b/reportbuilder/java/org/libreoffice/report/SDBCReportData.java
@@ -264,7 +264,7 @@ public class SDBCReportData implements DataSource
             str.append(' ');
             str.append(getTimeString(unoTs.Hours, unoTs.Minutes, unoTs.Seconds));
             str.append('.');
-            str.append(unoTs.HundredthSeconds);
+            str.append(String.format("%09d", unoTs.NanoSeconds));
             ts = java.sql.Timestamp.valueOf(str.toString());
         }
         else
diff --git a/reportdesign/source/filter/xml/xmlControlProperty.cxx b/reportdesign/source/filter/xml/xmlControlProperty.cxx
index aca8453..7d4ec15 100644
--- a/reportdesign/source/filter/xml/xmlControlProperty.cxx
+++ b/reportdesign/source/filter/xml/xmlControlProperty.cxx
@@ -34,6 +34,7 @@
 #include <tools/datetime.hxx>
 #include <unotools/datetime.hxx>
 #include <com/sun/star/util/DateTime.hpp>
+#include <rtl/math.hxx>
 
 #define TYPE_DATE       1
 #define TYPE_TIME       2
@@ -301,7 +302,7 @@ Any OXMLControlProperty::convertString(const ::com::sun::star::uno::Type& _rExpe
                             ::com::sun::star::util::Date aDate = implGetDate(nValue);
 
                             ::com::sun::star::util::DateTime aDateTime;
-                            aDateTime.HundredthSeconds = aTime.HundredthSeconds;
+                            aDateTime.NanoSeconds = aTime.NanoSeconds;
                             aDateTime.Seconds = aTime.Seconds;
                             aDateTime.Minutes = aTime.Minutes;
                             aDateTime.Hours = aTime.Hours;
@@ -329,10 +330,9 @@ Any OXMLControlProperty::convertString(const ::com::sun::star::uno::Type& _rExpe
 ::com::sun::star::util::Time OXMLControlProperty::implGetTime(double _nValue)
 {
     ::com::sun::star::util::Time aTime;
-    sal_uInt32 nIntValue = sal_Int32(_nValue * 8640000);
-    nIntValue *= 8640000;
-    aTime.HundredthSeconds = (sal_uInt16)( nIntValue % 100 );
-    nIntValue /= 100;
+    sal_uInt64 nIntValue = ::rtl::math::round(_nValue * 86400000000000.0);
+    aTime.NanoSeconds = (sal_uInt16)( nIntValue % 1000000000 );
+    nIntValue /= 1000000000;
     aTime.Seconds = (sal_uInt16)( nIntValue % 60 );
     nIntValue /= 60;
     aTime.Minutes = (sal_uInt16)( nIntValue % 60 );
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx
index 84d4da0..31e96bc 100644
--- a/sax/qa/cppunit/test_converter.cxx
+++ b/sax/qa/cppunit/test_converter.cxx
@@ -88,7 +88,7 @@ static bool eqDuration(util::Duration a, util::Duration b) {
     return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days
         && a.Hours == b.Hours && a.Minutes == b.Minutes
         && a.Seconds == b.Seconds
-        && a.MilliSeconds == b.MilliSeconds
+        && a.NanoSeconds == b.NanoSeconds
         && a.Negative == b.Negative;
 }
 
@@ -97,9 +97,10 @@ static void doTest(util::Duration const & rid, char const*const pis,
 {
     char const*const pos((i_pos) ? i_pos : pis);
     util::Duration od;
-    OUString is(OUString::createFromAscii(pis));
+    OUString is(::rtl::OUString::createFromAscii(pis));
+    SAL_INFO("sax.cppunit","about to convert '" << is << "'");
     bool bSuccess = Converter::convertDuration(od, is);
-    SAL_INFO("sax.cppunit","" << od.Negative << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.MilliSeconds << "m");
+    SAL_INFO("sax.cppunit","" << (od.Negative ? "-" : "+")  << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.NanoSeconds << "n");
     CPPUNIT_ASSERT(bSuccess);
     CPPUNIT_ASSERT(eqDuration(rid, od));
     OUStringBuffer buf;
@@ -113,7 +114,7 @@ static void doTestDurationF(char const*const pis)
     util::Duration od;
     bool bSuccess = Converter::convertDuration(od,
             OUString::createFromAscii(pis));
-    SAL_INFO("sax.cppunit","" << od.Negative << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.MilliSeconds << "H");
+    SAL_INFO("sax.cppunit","" << (od.Negative ? "-" : "+") << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.NanoSeconds << "n");
     CPPUNIT_ASSERT(!bSuccess);
 }
 
@@ -126,14 +127,15 @@ void ConverterTest::testDuration()
     doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" );
     doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" );
     doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" );
-    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" );
-    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" );
-    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" );
-    doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999),
-            "PT9.999999999999999999999999999999S", "PT9.999S" );
+    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190000000), "PT0.19S",        "PT0.190000000S");
+    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0,  90000000), "PT0.09S",        "PT0.090000000S" );
+    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0,   9000000), "PT0.009S",       "PT0.009000000S" );
+    doTest( util::Duration(false, 0, 0, 0, 0, 0, 0,         9), "PT0.000000009S", "PT0.000000009S" );
+    doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999999999),
+            "PT9.999999999999999999999999999999S", "PT9.999999999S" );
     doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" );
-    doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10),
-            "-P7Y6M5DT4H3M2.01S" );
+    doTest( util::Duration(true , 7, 6, 5, 4, 3, 2,  10000000),
+            "-P7Y6M5DT4H3M2.01S", "-P7Y6M5DT4H3M2.010000000S" );
     doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" );
     doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" );
     doTestDurationF("1Y1M");        // invalid: no ^P
@@ -155,7 +157,7 @@ static bool eqDateTime(util::DateTime a, util::DateTime b) {
     return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day
         && a.Hours == b.Hours && a.Minutes == b.Minutes
         && a.Seconds == b.Seconds
-        && a.HundredthSeconds == b.HundredthSeconds;
+        && a.NanoSeconds == b.NanoSeconds;
 }
 
 static void doTest(util::DateTime const & rdt, char const*const pis,
@@ -164,8 +166,9 @@ static void doTest(util::DateTime const & rdt, char const*const pis,
     char const*const pos((i_pos) ? i_pos : pis);
     OUString is(OUString::createFromAscii(pis));
     util::DateTime odt;
+    SAL_INFO("sax.cppunit","about to convert '" << is << "'");
     bool bSuccess( Converter::convertDateTime(odt, is) );
-    SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << "  H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " H:" << odt.HundredthSeconds);
+    SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << "  H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds);
     CPPUNIT_ASSERT(bSuccess);
     CPPUNIT_ASSERT(eqDateTime(rdt, odt));
     OUStringBuffer buf;
@@ -179,7 +182,7 @@ static void doTestDateTimeF(char const*const pis)
     util::DateTime odt;
     bool bSuccess = Converter::convertDateTime(odt,
             OUString::createFromAscii(pis));
-    SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << "  H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " H:" << odt.HundredthSeconds);
+    SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << "  H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds);
     CPPUNIT_ASSERT(!bSuccess);
 }
 
@@ -201,16 +204,16 @@ void ConverterTest::testDateTime()
     doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/,
             "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" );
 //            "0001-01-01T12:00:00" );
-    doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
-            "9999-12-31T23:59:59.99" );
-    doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
-            "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" );
-    doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+    doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999),
+            "9999-12-31T23:59:59.99",  "9999-12-31T23:59:59.990000000" );
+    doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999),
+            "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.990000000" );
+    doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999),
             "9999-12-31T23:59:59.9999999999999999999999999999999999999",
-            "9999-12-31T23:59:59.99" );
-    doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999),
+            "9999-12-31T23:59:59.999999999" );
+    doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999),
             "9999-12-31T23:59:59.9999999999999999999999999999999999999Z",
-            "9999-12-31T23:59:59.99" );
+            "9999-12-31T23:59:59.999999999" );
     doTest( util::DateTime(0, 0, 0, 0, 29, 2, 2000), // leap year
             "2000-02-29T00:00:00-00:00", "2000-02-29T00:00:00" );
     doTest( util::DateTime(0, 0, 0, 0, 29, 2, 1600), // leap year
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index 22fa906..6b88e10 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -29,6 +29,8 @@
 #include <rtl/ustrbuf.hxx>
 #include <rtl/math.hxx>
 
+#include <algorithm>
+
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::util;
@@ -43,8 +45,7 @@ static const sal_Char* gpsPT = "pt";
 static const sal_Char* gpsINCH = "in";
 static const sal_Char* gpsPC = "pc";
 
-const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11;
-const sal_Int8 XML_MAXDIGITSCOUNT_DATETIME = 6;
+const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 14;
 
 /** convert string to measure using optional min and max values*/
 bool Converter::convertMeasure( sal_Int32& rValue,
@@ -658,15 +659,15 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
     fValue *= 60;
     double fSecsValue = ::rtl::math::approxFloor (fValue);
     fValue -= fSecsValue;
-    double f100SecsValue;
-    if (fValue > 0.00001)
-        f100SecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - 5);
+    double fNanoSecsValue;
+    if (fValue > 0.00000000001)
+        fNanoSecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - 5);
     else
-        f100SecsValue = 0.0;
+        fNanoSecsValue = 0.0;
 
-    if (f100SecsValue == 1.0)
+    if (fNanoSecsValue == 1.0)
     {
-        f100SecsValue = 0.0;
+        fNanoSecsValue = 0.0;
         fSecsValue += 1.0;
     }
     if (fSecsValue >= 60.0)
@@ -691,15 +692,15 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
     if (fSecsValue < 10)
         rBuffer.append( sal_Unicode('0'));
     rBuffer.append( sal_Int32( fSecsValue));
-    if (f100SecsValue > 0.0)
+    if (fNanoSecsValue > 0.0)
     {
-        OUString a100th( ::rtl::math::doubleToUString( fValue,
+        OUString aNS( ::rtl::math::doubleToUString( fValue,
                     rtl_math_StringFormat_F, XML_MAXDIGITSCOUNT_TIME - 5, '.',
                     true));
-        if ( a100th.getLength() > 2 )
+        if ( aNS.getLength() > 2 )
         {
             rBuffer.append( sal_Unicode('.'));
-            rBuffer.append( a100th.copy( 2 ) );     // strip 0.
+            rBuffer.append( aNS.copy( 2 ) );     // strip "0."
         }
     }
     rBuffer.append( sal_Unicode('S'));
@@ -816,12 +817,10 @@ bool Converter::convertDuration(double& rfTime,
         double fHour = nHours;
         double fMin = nMins;
         double fSec = nSecs;
-        double fSec100 = 0.0;
         double fFraction = sDoubleStr.toDouble();
         fTempTime = fHour / 24;
         fTempTime += fMin / (24 * 60);
         fTempTime += fSec / (24 * 60 * 60);
-        fTempTime += fSec100 / (24 * 60 * 60 * 60);
         fTempTime += fFraction / (24 * 60 * 60);
 
         // negative duration?
@@ -835,7 +834,7 @@ bool Converter::convertDuration(double& rfTime,
     return bSuccess;
 }
 
-/** convert util::Duration to ISO "duration" string */
+/** convert util::Duration to ISO8601 "duration" string */
 void Converter::convertDuration(OUStringBuffer& rBuffer,
         const ::util::Duration& rDuration)
 {
@@ -844,9 +843,9 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
         rBuffer.append(sal_Unicode('-'));
     }
     rBuffer.append(sal_Unicode('P'));
-    const bool bHaveDate(static_cast<sal_Int32>(rDuration.Years)
-                        +static_cast<sal_Int32>(rDuration.Months)
-                        +static_cast<sal_Int32>(rDuration.Days));
+    const bool bHaveDate(rDuration.Years  != 0 ||
+                         rDuration.Months != 0 ||
+                         rDuration.Days   != 0);
     if (rDuration.Years)
     {
         rBuffer.append(static_cast<sal_Int32>(rDuration.Years));
@@ -862,10 +861,10 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
         rBuffer.append(static_cast<sal_Int32>(rDuration.Days));
         rBuffer.append(sal_Unicode('D'));
     }
-    const sal_Int32 nMSecs(static_cast<sal_Int32>(rDuration.Seconds)
-                         + static_cast<sal_Int32>(rDuration.MilliSeconds));
-    if (static_cast<sal_Int32>(rDuration.Hours) +
-        static_cast<sal_Int32>(rDuration.Minutes) + nMSecs)
+    if ( rDuration.Hours != 0
+         || rDuration.Minutes != 0
+         || rDuration.Seconds != 0
+         || rDuration.NanoSeconds != 0 )
     {
         rBuffer.append(sal_Unicode('T')); // time separator
         if (rDuration.Hours)
@@ -878,37 +877,19 @@ void Converter::convertDuration(OUStringBuffer& rBuffer,
             rBuffer.append(static_cast<sal_Int32>(rDuration.Minutes));
             rBuffer.append(sal_Unicode('M'));
         }
-        if (nMSecs)
+        if (rDuration.Seconds != 0 || rDuration.NanoSeconds != 0)
         {
             // seconds must not be omitted (i.e. ".42S" is not valid)
             rBuffer.append(static_cast<sal_Int32>(rDuration.Seconds));
-            if (rDuration.MilliSeconds)
+            if (rDuration.NanoSeconds)
             {
-                rBuffer.append(sal_Unicode('.'));
-                const sal_Int32 nMilliSeconds(rDuration.MilliSeconds % 1000);
-                if (nMilliSeconds < 100)
-                {
-                    rBuffer.append(sal_Unicode('0'));
-                }
-                if (nMilliSeconds < 10)
-                {
-                    rBuffer.append(sal_Unicode('0'));
-                }
-                if (0 == (nMilliSeconds % 10))
-                {
-                    if (0 == (nMilliSeconds % 100))
-                    {
-                        rBuffer.append(nMilliSeconds / 100);
-                    }
-                    else
-                    {
-                        rBuffer.append(nMilliSeconds / 10);
-                    }
-                }
-                else
-                {
-                    rBuffer.append(nMilliSeconds);
-                }
+                OSL_ENSURE(rDuration.NanoSeconds < 1000000000,"NanoSeconds cannot be more than 999 999 999");
+                rBuffer.append('.');
+                std::ostringstream ostr;
+                ostr.fill('0');
+                ostr.width(9);
+                ostr << rDuration.NanoSeconds;
+                rBuffer.append(OUString::createFromAscii(ostr.str().c_str()));
             }
             rBuffer.append(sal_Unicode('S'));
         }
@@ -928,7 +909,7 @@ readUnsignedNumber(const OUString & rString,
     sal_Int32 & io_rnPos, sal_Int32 & o_rNumber)
 {
     bool bOverflow(false);
-    sal_Int32 nTemp(0);
+    sal_Int64 nTemp(0);
     sal_Int32 nPos(io_rnPos);
 
     while (nPos < rString.getLength())
@@ -938,7 +919,7 @@ readUnsignedNumber(const OUString & rString,
         {
             nTemp *= 10;
             nTemp += (c - sal_Unicode('0'));
-            if (nTemp >= SAL_MAX_INT16)
+            if (nTemp >= SAL_MAX_INT32)
             {
                 bOverflow = true;
             }
@@ -961,6 +942,50 @@ readUnsignedNumber(const OUString & rString,
     return (bOverflow) ? R_OVERFLOW : R_SUCCESS;
 }
 
+static Result
+readUnsignedNumberMaxDigits(int maxDigits,
+                            const ::rtl::OUString & rString, sal_Int32 & io_rnPos,
+                            sal_Int32 & o_rNumber)
+{
+    bool bOverflow(false);
+    sal_Int64 nTemp(0);
+    sal_Int32 nPos(io_rnPos);
+    OSL_ENSURE(maxDigits >= 0, "negative amount of digits makes no sense");
+
+    while (nPos < rString.getLength())
+    {
+        const sal_Unicode c = rString[nPos];
+        if ((sal_Unicode('0') <= c) && (c <= sal_Unicode('9')))
+        {
+            if (maxDigits > 0)
+            {
+                nTemp *= 10;
+                nTemp += (c - sal_Unicode('0'));
+                if (nTemp >= SAL_MAX_INT32)
+                {
+                    bOverflow = true;
+                }
+                --maxDigits;
+            }
+        }
+        else
+        {
+            break;
+        }
+        ++nPos;
+    }
+
+    if (io_rnPos == nPos) // read something?
+    {
+        o_rNumber = -1;
+        return R_NOTHING;
+    }
+
+    io_rnPos = nPos;
+    o_rNumber = nTemp;
+    return (bOverflow) ? R_OVERFLOW : R_SUCCESS;
+}
+
 static bool
 readDurationT(const OUString & rString, sal_Int32 & io_rnPos)
 {
@@ -1003,7 +1028,7 @@ readDurationComponent(const OUString & rString,
     return true;
 }
 
-/** convert ISO "duration" string to util::Duration */
+/** convert ISO8601 "duration" string to util::Duration */
 bool Converter::convertDuration(util::Duration& rDuration,
                                 const OUString& rString)
 {
@@ -1035,7 +1060,7 @@ bool Converter::convertDuration(util::Duration& rDuration,
     sal_Int32 nHours(0);
     sal_Int32 nMinutes(0);
     sal_Int32 nSeconds(0);
-    sal_Int32 nMilliSeconds(0);
+    sal_Int32 nNanoSeconds(0);
 
     bTimePart = readDurationT(string, nPos);
     bSuccess = (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp));
@@ -1080,7 +1105,8 @@ bool Converter::convertDuration(util::Duration& rDuration,
         // eeek! seconds are icky.
         if ((nPos < string.getLength()) && bSuccess)
         {
-            if (sal_Unicode('.') == string[nPos])
+            if (string[nPos] == sal_Unicode('.') ||
+                string[nPos] == sal_Unicode(','))
             {
                 ++nPos;
                 if (-1 != nTemp)
@@ -1088,27 +1114,15 @@ bool Converter::convertDuration(util::Duration& rDuration,
                     nSeconds = nTemp;
                     nTemp = -1;
                     const sal_Int32 nStart(nPos);
-                    bSuccess =
-                        (R_NOTHING != readUnsignedNumber(string, nPos, nTemp));
+                    bSuccess = readUnsignedNumberMaxDigits(9, string, nPos, nTemp) == R_SUCCESS;
                     if ((nPos < string.getLength()) && bSuccess)
                     {
                         if (-1 != nTemp)
                         {
-                            nTemp = -1;
-                            const sal_Int32 nDigits = nPos - nStart;
-                            OSL_ENSURE(nDigits > 0, "bad code monkey");
-                            const sal_Unicode cZero('0');
-                            nMilliSeconds = 100 * (string[nStart] - cZero);
-                            if (nDigits >= 2)
-                            {
-                                nMilliSeconds += 10 *
-                                    (string[nStart+1] - cZero);
-                                if (nDigits >= 3)
-                                {
-                                    nMilliSeconds += (string[nStart+2] - cZero);
-                                }
-                            }
-
+                            const sal_Int32 nDigits = std::min<sal_Int32>(nPos - nStart, 9);
+                            OSL_ENSURE(nDigits > 0, "bad code monkey: negative digits");
+                            nNanoSeconds=static_cast<double>(nTemp)*(1000000000.0/pow(10.0,nDigits));
+                            nTemp=-1;
                             if (sal_Unicode('S') == string[nPos])
                             {
                                 ++nPos;
@@ -1164,7 +1178,7 @@ bool Converter::convertDuration(util::Duration& rDuration,
         rDuration.Hours         = static_cast<sal_Int16>(nHours);
         rDuration.Minutes       = static_cast<sal_Int16>(nMinutes);
         rDuration.Seconds       = static_cast<sal_Int16>(nSeconds);
-        rDuration.MilliSeconds  = static_cast<sal_Int16>(nMilliSeconds);
+        rDuration.NanoSeconds   = static_cast<sal_Int32>(nNanoSeconds);
     }
 
     return bSuccess;
@@ -1232,13 +1246,14 @@ void Converter::convertDateTime(
             i_rBuffer.append(zero);
         }
         i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Seconds) );
-        if( i_rDateTime.HundredthSeconds > 0 ) {
+        if( i_rDateTime.NanoSeconds > 0 ) {
+            OSL_ENSURE(i_rDateTime.NanoSeconds < 1000000000,"NanoSeconds cannot be more than 999 999 999");
             i_rBuffer.append(dot);
-            if( i_rDateTime.HundredthSeconds < 10 ) {
-                i_rBuffer.append(zero);
-            }
-            i_rBuffer.append(
-                static_cast<sal_Int32>(i_rDateTime.HundredthSeconds) );
+            std::ostringstream ostr;
+            ostr.fill('0');
+            ostr.width(9);
+            ostr << i_rDateTime.NanoSeconds;
+            i_rBuffer.append(OUString::createFromAscii(ostr.str().c_str()));
         }
     }
 }
@@ -1259,7 +1274,7 @@ bool Converter::convertDateTime( util::DateTime& rDateTime,
             rDateTime.Hours = 0;
             rDateTime.Minutes = 0;
             rDateTime.Seconds = 0;
-            rDateTime.HundredthSeconds = 0;
+            rDateTime.NanoSeconds = 0;
         }
         return true;
     }
@@ -1381,7 +1396,7 @@ bool Converter::convertDateOrDateTime(
     sal_Int32 nHours(0);
     sal_Int32 nMinutes(0);
     sal_Int32 nSeconds(0);
-    sal_Int32 nMilliSeconds(0);
+    sal_Int32 nNanoSeconds(0);
     if (bSuccess && bHaveTime)
     {
         {
@@ -1419,37 +1434,26 @@ bool Converter::convertDateOrDateTime(
             bSuccess &= (0 <= nSeconds) && (nSeconds < 60);
         }
         if (bSuccess && (nPos < string.getLength()) &&
-            (sal_Unicode('.') == string[nPos])) // fraction separator
+            (sal_Unicode('.') == string[nPos] || sal_Unicode(',') == string[nPos])) // fraction separator
         {
             ++nPos;
             const sal_Int32 nStart(nPos);
             sal_Int32 nTemp(0);
-            if (R_NOTHING == readUnsignedNumber(string, nPos, nTemp))
+            if (R_NOTHING == readUnsignedNumberMaxDigits(9, string, nPos, nTemp))
             {
                 bSuccess = false;
             }
             if (bSuccess)
             {
-                // cannot use nTemp because of possible leading zeros
-                // and possible overflow => read digits directly
-                const sal_Int32 nDigits(nPos - nStart);
+                const sal_Int32 nDigits = std::min<sal_Int32>(nPos - nStart, 9);
                 OSL_ENSURE(nDigits > 0, "bad code monkey");
-                const sal_Unicode cZero('0');
-                nMilliSeconds = 100 * (string[nStart] - cZero);
-                if (nDigits >= 2)
-                {
-                    nMilliSeconds += 10 * (string[nStart+1] - cZero);
-                    if (nDigits >= 3)
-                    {
-                        nMilliSeconds += (string[nStart+2] - cZero);
-                    }
-                }
+                nNanoSeconds=static_cast<double>(nTemp)*(1000000000.0/pow(10.0,nDigits));
             }
         }
 
         if (bSuccess && (nHours == 24))
         {
-            if (!((0 == nMinutes) && (0 == nSeconds) && (0 == nMilliSeconds)))
+            if (!((0 == nMinutes) && (0 == nSeconds) && (0 == nNanoSeconds)))
             {
                 bSuccess = false; // only 24:00:00 is valid
             }
@@ -1533,9 +1537,7 @@ bool Converter::convertDateOrDateTime(
             rDateTime.Hours = static_cast<sal_uInt16>(nHours);
             rDateTime.Minutes = static_cast<sal_uInt16>(nMinutes);
             rDateTime.Seconds = static_cast<sal_uInt16>(nSeconds);
-            // util::DateTime does not support 3 decimal digits of precision!
-            rDateTime.HundredthSeconds =
-                static_cast<sal_uInt16>(nMilliSeconds / 10);
+            rDateTime.NanoSeconds = static_cast<sal_uInt32>(nNanoSeconds);
             rbDateTime = true;
         }
         else
@@ -2279,7 +2281,7 @@ bool Converter::convertAny(OUStringBuffer&    rsValue,
                     aTempValue.Day              = aDate.Day;
                     aTempValue.Month            = aDate.Month;
                     aTempValue.Year             = aDate.Year;
-                    aTempValue.HundredthSeconds = 0;
+                    aTempValue.NanoSeconds = 0;
                     aTempValue.Seconds          = 0;
                     aTempValue.Minutes          = 0;
                     aTempValue.Hours            = 0;
@@ -2294,7 +2296,7 @@ bool Converter::convertAny(OUStringBuffer&    rsValue,
                     aTempValue.Days             = 0;
                     aTempValue.Months           = 0;
                     aTempValue.Years            = 0;
-                    aTempValue.MilliSeconds     = aTime.HundredthSeconds * 10;
+                    aTempValue.NanoSeconds     = aTime.NanoSeconds;
                     aTempValue.Seconds          = aTime.Seconds;
                     aTempValue.Minutes          = aTime.Minutes;
                     aTempValue.Hours            = aTime.Hours;
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 38b683c..aef13cf 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -925,7 +925,7 @@ class ScChangeTrack : public utl::ConfigurationListener
     bool bInDeleteTop:1;
     bool bInPasteCut:1;
     bool bUseFixDateTime:1;
-    bool bTime100thSeconds:1;
+    bool bTimeNanoSeconds:1;
 
     // not implemented, prevent usage
     ScChangeTrack( const ScChangeTrack& );
@@ -1235,9 +1235,9 @@ public:
 
                                 // If time stamps of actions of this
                                 // ChangeTrack and a second one are to be
-                                // compared including 100th seconds.
-    void SetTime100thSeconds( bool bVal ) { bTime100thSeconds = bVal; }
-    bool IsTime100thSeconds() const { return bTime100thSeconds; }
+                                // compared including nanoseconds.
+    void SetTimeNanoSeconds( bool bVal ) { bTimeNanoSeconds = bVal; }
+    bool IsTimeNanoSeconds() const { return bTimeNanoSeconds; }
 
     void AppendCloned( ScChangeAction* pAppend );
     SC_DLLPUBLIC ScChangeTrack* Clone( ScDocument* pDocument ) const;
diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx
index eb244f7..a03250a 100644
--- a/sc/source/core/data/dbdocutl.cxx
+++ b/sc/source/core/data/dbdocutl.cxx
@@ -109,8 +109,10 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
                                         NUMBERFORMAT_TIME, ScGlobal::eLnge );
 
                     util::Time aTime = xRow->getTime(nRowPos);
-                    nVal = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
-                             aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / DATE_TIME_FACTOR;
+                    nVal = aTime.Hours       / static_cast<double>(::Time::hourPerDay)   +
+                           aTime.Minutes     / static_cast<double>(::Time::minutePerDay) +
+                           aTime.Seconds     / static_cast<double>(::Time::secondPerDay) +
+                           aTime.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay);
                     bEmptyFlag = xRow->wasNull();
                     bValue = sal_True;
                 }
@@ -125,8 +127,10 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
                     util::DateTime aStamp = xRow->getTimestamp(nRowPos);
                     nVal = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) -
                                                 *pFormTable->GetNullDate() ) +
-                           ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
-                             aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / DATE_TIME_FACTOR;
+                           aStamp.Hours       / static_cast<double>(::Time::hourPerDay)   +
+                           aStamp.Minutes     / static_cast<double>(::Time::minutePerDay) +
+                           aStamp.Seconds     / static_cast<double>(::Time::secondPerDay) +
+                           aStamp.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay);
                     bEmptyFlag = xRow->wasNull();
                     bValue = sal_True;
                 }
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index c8f3fff..7033170 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -104,8 +104,6 @@ using ::com::sun::star::beans::XPropertySet;
 
 namespace {
 
-const double D_TIMEFACTOR = 86400.0;
-
 /**
  * Database connection implementation for UNO database API.  Note that in
  * the UNO database API, column index is 1-based, whereas the interface
@@ -220,8 +218,10 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons
                 rNumType = NUMBERFORMAT_TIME;
 
                 util::Time aTime = mxRow->getTime(nCol+1);
-                fValue = ( aTime.Hours * 3600 + aTime.Minutes * 60 +
-                           aTime.Seconds + aTime.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+                fValue = aTime.Hours       / static_cast<double>(::Time::hourPerDay)   +
+                         aTime.Minutes     / static_cast<double>(::Time::minutePerDay) +
+                         aTime.Seconds     / static_cast<double>(::Time::secondPerDay) +
+                         aTime.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay);
                 rData.SetValue(fValue);
                 break;
             }
@@ -231,8 +231,10 @@ void DBConnector::getValue(long nCol, ScDPItemData &rData, short& rNumType) cons
 
                 util::DateTime aStamp = mxRow->getTimestamp(nCol+1);
                 fValue = ( Date( aStamp.Day, aStamp.Month, aStamp.Year ) - maNullDate ) +
-                         ( aStamp.Hours * 3600 + aStamp.Minutes * 60 +
-                           aStamp.Seconds + aStamp.HundredthSeconds / 100.0 ) / D_TIMEFACTOR;
+                         aStamp.Hours       / static_cast<double>(::Time::hourPerDay)   +
+                         aStamp.Minutes     / static_cast<double>(::Time::minutePerDay) +
+                         aStamp.Seconds     / static_cast<double>(::Time::secondPerDay) +
+                         aStamp.NanoSeconds / static_cast<double>(::Time::nanoSecPerDay);
                 rData.SetValue(fValue);
                 break;
             }
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 5425056..254e423 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2232,7 +2232,7 @@ void ScChangeTrack::Init()
     bInDeleteUndo = false;
     bInPasteCut = false;
     bUseFixDateTime = false;
-    bTime100thSeconds = true;
+    bTimeNanoSeconds = true;
 
     const SvtUserOptions& rUserOpt = SC_MOD()->GetUserOptions();
     OUStringBuffer aBuf;
@@ -4556,7 +4556,7 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
     }
 
     ScChangeTrack* pClonedTrack = new ScChangeTrack( pDocument );
-    pClonedTrack->SetTime100thSeconds( IsTime100thSeconds() );
+    pClonedTrack->SetTimeNanoSeconds( IsTimeNanoSeconds() );
 
     // clone generated actions
     ::std::stack< const ScChangeAction* > aGeneratedStack;
diff --git a/sc/source/core/tool/chgviset.cxx b/sc/source/core/tool/chgviset.cxx
index 06f1f292..e924a060 100644
--- a/sc/source/core/tool/chgviset.cxx
+++ b/sc/source/core/tool/chgviset.cxx
@@ -138,7 +138,7 @@ void ScChangeViewSettings::AdjustDateMode( const ScDocument& rDoc )
                     // all together during the gap between those two times.
                     aFirstDateTime += Time( 0, 1 );
                     aFirstDateTime.SetSec(0);
-                    aFirstDateTime.Set100Sec(0);
+                    aFirstDateTime.SetNanoSec(0);
                 }
             }
             if ( !pLast )
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index ad4daa7..5743f1d 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -51,6 +51,7 @@
 using namespace formula;
 
 #define SCdEpsilon                1.0E-7
+#define D_TIMEFACTOR              static_cast<double>(::Time::secondPerDay)
 
 //-----------------------------------------------------------------------------
 // Datum und Zeit
@@ -113,10 +114,10 @@ void ScInterpreter::ScGetActTime()
     Date aActDate( Date::SYSTEM );
     long nDiff = aActDate - *(pFormatter->GetNullDate());
     Time aActTime( Time::SYSTEM );
-    double nTime = ((double)aActTime.Get100Sec() / 100 +
-                    (double)(aActTime.GetSec()        +
-                            (aActTime.GetMin()  * 60) +
-                            (aActTime.GetHour() * 3600))) / DATE_TIME_FACTOR;
+    double nTime = aActTime.GetHour()    / static_cast<double>(::Time::hourPerDay)   +
+                   aActTime.GetMin()     / static_cast<double>(::Time::minutePerDay) +
+                   aActTime.GetSec()     / static_cast<double>(::Time::secondPerDay) +
+                   aActTime.GetNanoSec() / static_cast<double>(::Time::nanoSecPerDay);
     PushDouble( (double) nDiff + nTime );
 }
 
@@ -149,8 +150,8 @@ void ScInterpreter::ScGetMin()
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMin" );
     double fTime = GetDouble();
     fTime -= ::rtl::math::approxFloor(fTime);       // Datumsanteil weg
-    long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % 3600;
-    PushDouble( (double) (nVal/60) );
+    long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % ::Time::secondPerHour;
+    PushDouble( (double) (nVal / ::Time::secondPerMinute) );
 }
 
 void ScInterpreter::ScGetSec()
@@ -158,7 +159,7 @@ void ScInterpreter::ScGetSec()
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetSec" );
     double fTime = GetDouble();
     fTime -= ::rtl::math::approxFloor(fTime);       // Datumsanteil weg
-    long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % 60;
+    long nVal = (long)::rtl::math::approxFloor(fTime*DATE_TIME_FACTOR+0.5) % ::Time::secondPerMinute;
     PushDouble( (double) nVal );
 }
 

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list