[ruby-oci8-commit] [382] trunk/ruby-oci8: * lib/oci8/datetime.rb: fix a problem that fractional seconds are lost

nobody at rubyforge.org nobody at rubyforge.org
Sat Feb 27 09:18:56 EST 2010


Revision: 382
Author:   kubo
Date:     2010-02-27 09:18:56 -0500 (Sat, 27 Feb 2010)

Log Message:
-----------
* lib/oci8/datetime.rb: fix a problem that fractional seconds are lost
    when Time value is bound to TIMESTAMP.
    (reported by Raimonds Simanovskis)

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/lib/oci8/datetime.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2010-02-27 12:32:53 UTC (rev 381)
+++ trunk/ruby-oci8/ChangeLog	2010-02-27 14:18:56 UTC (rev 382)
@@ -1,4 +1,9 @@
 2010-02-27  KUBO Takehiro  <kubo at jiubao.org>
+	* lib/oci8/datetime.rb: fix a problem that fractional seconds are lost
+	    when Time value is bound to TIMESTAMP.
+	    (reported by Raimonds Simanovskis)
+
+2010-02-27  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/error.c, ext/oci8/extconf.rb, ext/oci8/oci8.h: fix for
 	    old Oracle versions, which lack declarations of OCIMsg, oraub8,
 	    orasb8 and OCI_DURATION_PROCESS.

Modified: trunk/ruby-oci8/lib/oci8/datetime.rb
===================================================================
--- trunk/ruby-oci8/lib/oci8/datetime.rb	2010-02-27 12:32:53 UTC (rev 381)
+++ trunk/ruby-oci8/lib/oci8/datetime.rb	2010-02-27 14:18:56 UTC (rev 382)
@@ -92,9 +92,13 @@
         end
         return [year, month, day, hour, minute, sec] unless full
 
-        # sec_fraction
+        # fractional second
         if val.respond_to? :sec_fraction
           fsec = (val.sec_fraction * @@datetime_fsec_base).to_i
+        elsif val.respond_to? :nsec
+          fsec = val.nsec
+        elsif val.respond_to? :usec
+          fsec = val.usec * 1000
         else
           fsec = 0
         end




More information about the ruby-oci8-commit mailing list