Tag: cws_src680_dba204a
User: oj      
Date: 06/05/05 02:25:12

Modified:
 /dba/connectivity/source/commontools/
  dbconversion.cxx

Log:
 #i65063# use nanos as well

File Changes:

Directory: /dba/connectivity/source/commontools/
================================================

File [changed]: dbconversion.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/commontools/dbconversion.cxx?r1=1.24&r2=1.24.32.1
Delta lines:  +16 -9
--------------------
--- dbconversion.cxx    14 Mar 2006 10:47:30 -0000      1.24
+++ dbconversion.cxx    5 May 2006 09:25:10 -0000       1.24.32.1
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: dbconversion.cxx,v $
  *
- *  $Revision: 1.24 $
+ *  $Revision: 1.24.32.1 $
  *
- *  last change: $Author: vg $ $Date: 2006/03/14 10:47:30 $
+ *  last change: $Author: oj $ $Date: 2006/05/05 09:25:10 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -456,9 +456,9 @@
     
//-----------------------------------------------------------------------------
     DateTime DBTypeConversion::toDateTime(const ::rtl::OUString& _sSQLString)
     {
-        // This is very suspicious. Is there any documentation about the 
format of the string?
-        // Our assumption is that it's "YYYY-MM-DD HH:MM:SS", which makes 
sense, but how do we know?
-        // #i14997# - 2003-06-05 - [EMAIL PROTECTED]
+        //@see 
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Timestamp.html#valueOf(java.lang.String)
+        //@see 
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Date.html#valueOf(java.lang.String)
+        //@see 
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Time.html#valueOf(java.lang.String)
 
         // the date part
         Date aDate = toDate(_sSQLString);
@@ -467,7 +467,7 @@
         if ( -1 != nSeparation )
             aTime = toTime( _sSQLString.copy( nSeparation ) );
 
-        return 
DateTime(0,aTime.Seconds,aTime.Minutes,aTime.Hours,aDate.Day,aDate.Month,aDate.Year);
+        return 
DateTime(aTime.HundredthSeconds,aTime.Seconds,aTime.Minutes,aTime.Hours,aDate.Day,aDate.Month,aDate.Year);
     }
 
     
//-----------------------------------------------------------------------------
@@ -478,15 +478,22 @@
         sal_Int32 nIndex    = 0;
         sal_uInt16  nHour   = 0,
                     nMinute = 0,
-                    nSecond = 0;
+                    nSecond = 0,
+                    nNano   = 0;
         nHour   = 
(sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32();
         if(nIndex != -1)
         {
             nMinute = 
(sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32();
             if(nIndex != -1)
+            {
                 nSecond = 
(sal_uInt16)_sSQLString.getToken(0,sTimeSep,nIndex).toInt32();
+                nIndex = 0;
+                ::rtl::OUString sNano(_sSQLString.getToken(1,'.',nIndex));
+                if ( sNano.getLength() )
+                    nNano = (sal_uInt16)sNano.toInt32();
+            }
         }
-        return Time(0,nSecond,nMinute,nHour);
+        return Time(nNano,nSecond,nMinute,nHour);
     }
 
 //.........................................................................




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to