diff --git a/contrib/ruby/ext/trilogy-ruby/cast.c b/contrib/ruby/ext/trilogy-ruby/cast.c index 15dbe836..c3e629cc 100644 --- a/contrib/ruby/ext/trilogy-ruby/cast.c +++ b/contrib/ruby/ext/trilogy-ruby/cast.c @@ -233,10 +233,6 @@ rb_trilogy_cast_value(const trilogy_value_t *value, const struct column_info *co return Qnil; } - if (hour == 0 && min == 0 && sec == 0) { - return Qnil; - } - // pad out msec_char with zeroes at the end as it could be at any // level of precision for (size_t i = strlen(msec_char); i < sizeof(msec_char) - 1; i++) { diff --git a/contrib/ruby/test/cast_test.rb b/contrib/ruby/test/cast_test.rb index a0261168..d78ea2f8 100644 --- a/contrib/ruby/test/cast_test.rb +++ b/contrib/ruby/test/cast_test.rb @@ -254,6 +254,23 @@ def test_time_cast_local assert_kind_of Time, results[0][0] end + def test_time_zero + time = Time.utc(2000, 1, 1, 0, 0, 0) + + @client.query(<<-SQL) + INSERT INTO trilogy_test (time_test) + VALUES ("#{time.strftime("%H:%M:%S")}") + SQL + + results = @client.query(<<-SQL).to_a + SELECT time_test FROM trilogy_test + SQL + + assert_equal [[time]], results + + assert_kind_of Time, results[0][0] + end + def test_timestamp_cast_defaults_to_utc @client.query(<<-SQL) INSERT INTO trilogy_test (null_test)