summaryrefslogtreecommitdiff
path: root/test/win32ole
diff options
context:
space:
mode:
authorsuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-27 10:57:28 +0000
committersuke <suke@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-27 10:57:28 +0000
commitef7b9bf382a8e6efa472e197b8b2f8dab48cba43 (patch)
treec126c54d049ce2bcf168cbfb5bb174a2456c0b6c /test/win32ole
parent66c2bbdea3f4f7b0ce988f66e7e0fa555c696d53 (diff)
* ext/win32ole/win32ole.c (vtdate2rbtime): try to convert millisecond
of VT_DATE VARIANT to nsec of Time object. * test/win32ole/test_win32ole_variant.rb (test_conversion_dbl2date_with_msec): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/win32ole')
-rw-r--r--test/win32ole/test_win32ole_variant.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb
index 91e3c0d..216449f 100644
--- a/test/win32ole/test_win32ole_variant.rb
+++ b/test/win32ole/test_win32ole_variant.rb
@@ -388,6 +388,14 @@ if defined?(WIN32OLE_VARIANT)
assert_equal(dt, obj.value)
end
+ def test_conversion_dbl2date_with_msec
+ # Date is "2014/8/27 12:34:56.789"
+ obj = WIN32OLE_VARIANT.new(41878.524268391200167, WIN32OLE::VARIANT::VT_DATE)
+ t = obj.value
+ assert_equal("2014-08-27 12:34:56", t.strftime('%Y-%m-%d %H:%M:%S'))
+ assert_equal(789, (t.nsec / 1000000).round)
+ end
+
# this test failed because of VariantTimeToSystemTime
# and SystemTimeToVariantTime API ignores wMilliseconds
# member of SYSTEMTIME struct.