#271 seems to have introduced a daylight-savings-related bug.
If I can't fix it quickly, I may temporarily revert that PR for now.
# Run with: TZ=America/New_York
require "trilogy"
client = Trilogy.new(host: "127.0.0.1", username: "root", database: "test")
client.query_flags |= Trilogy::QUERY_FLAGS_LOCAL_TIMEZONE
client.query("DROP TABLE IF EXISTS dst_test")
client.query("CREATE TABLE dst_test (id INT AUTO_INCREMENT PRIMARY KEY, ts DATETIME)")
# This time appears once in EDT and once in EST
client.query("INSERT INTO dst_test (ts) VALUES ('2024-11-03 01:21:54')")
time = client.query("SELECT ts FROM dst_test").to_a[0][0]
expected = Time.local(2024, 11, 3, 1, 21, 54)
puts "Trilogy result: #{time} (utc_offset=#{time.utc_offset}, dst=#{time.dst?})"
puts "Time.local: #{expected} (utc_offset=#{expected.utc_offset}, dst=#{expected.dst?})"
puts "diff: #{time.to_i - expected.to_i} seconds"
raise "don't match" unless time == expected
#271 seems to have introduced a daylight-savings-related bug.
If I can't fix it quickly, I may temporarily revert that PR for now.