Exemplo
tzinfo-data 1.2026.3: Handle Irish negative daylight saving time in Europe/Dublin and fractional timezone offsets via tzinfo-data 1.2026.3 RubyDataSource
Amostra verificada para gem tzinfo-data 1.2026.3: Handle Irish negative daylight saving time in Europe/Dublin and fractional timezone offsets via tzinfo-data…
sha256:967b44b9ed23ee74332149fbaf7c9fe13f8adea23da770d3fe56ada88ca65a89
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 2
- Chaves de assinatura que o compilaram
- 2
Ambiente declarado
ruby linux x64 ruby ruby bundler
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| ruby 3 · linux debian/x64 · docker ed25519:d91480838ac982c9 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-17 |
| ruby 3 · linux debian/x64 · docker ed25519:2175b912ea1c23b1 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · rubygems@1 |
2026-08-18 |
Caso
HOW- Objetivo
- Handle Irish negative daylight saving time in Europe/Dublin and fractional timezone offsets via tzinfo-data 1.2026.3 RubyDataSource
- Pacotes
- Símbolos
-
- TZInfo::Data
- TZInfo::DataSources::RubyDataSource
- TZInfo::Timezone#period_for_utc
- TZInfo::Country#zone_info
- Ambiente
- ruby
- Criado
- 2026-08-17T18:34:40Z
Contrato
- In Europe/Dublin under tzdata 2026c, winter periods have dst? set to true with a negative daylight saving offset of -3600 seconds (GMT) and summer periods have dst? set to false with standard offset 0 (IST), because Irish law defines IST (UTC+1) as standard time.
- Australia/Lord_Howe uses a 30-minute daylight saving offset of +1800 seconds in summer (+11:00 total offset) rather than a standard 1-hour shift.
- Asia/Kathmandu resolves with a fractional +05:45 total UTC offset (20700 seconds) without daylight saving transitions.
- TZInfo::Country#zone_info exposes latitude and longitude as exact Rational fractions (degrees and arc-minutes) rather than floating-point approximations.
- Timezone definitions under TZInfo::Data::Definitions are lazily required and defined on first query by RubyDataSource.
Arquivos
- Gemfile
- Gemfile.lock
- NOTES.md
- csx.json
- test/contract.rb
Código-fonte
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'tzinfo', '2.0.6'
gem 'tzinfo-data', '1.2026.3'
GEM
remote: https://rubygems.org/
specs:
concurrent-ruby (1.3.8)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2026.3)
tzinfo (>= 1.0.0)
PLATFORMS
ruby
x64-mingw-ucrt
DEPENDENCIES
tzinfo (= 2.0.6)
tzinfo-data (= 1.2026.3)
CHECKSUMS
bundler (4.0.18) sha256=02d9a17429de1847b4e0c9f27a9ee4b20c0a74c0a641b4e77195d6019e3618ac
concurrent-ruby (1.3.8) sha256=b2f1be836e968ccc78ccfce277ea79c72a88633f22306782c16ff23fb415d1e1
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
tzinfo-data (1.2026.3) sha256=478fbc5356f13c1004cf8372b1336f3dad4055c96340fc4c881a3738da8cf7f9
BUNDLED WITH
4.0.18
# tzinfo-data 1.2026.3 Timezone Handling and Offset Behavior
## Prior Search Results
A search for `tzinfo-data` returned an existing sample (`sha256:59c369149379c8926252215b1aa4d9b045a74b3de4aebecc440b0348baec877c`) demonstrating basic RubyDataSource activation, linked aliases, and standard transitions in America/New_York. This sample investigates negative daylight saving time in Europe/Dublin, partial-hour DST transitions in Australia/Lord_Howe, fractional 45-minute base offsets, exact Rational coordinate representations, and lazy loading of definition modules.
## Pinned Release
- `tzinfo-data`: `1.2026.3`
- `tzinfo`: `2.0.6`
## Observed Behaviour
### 1. Negative Daylight Saving Time Trap (Europe/Dublin)
Under IANA tzdata 2026c, the timezone `Europe/Dublin` reflects Irish law (the Standard Time Act 1968), where Irish Standard Time (IST, UTC+1) is defined as standard time rather than Greenwich Mean Time (GMT).
- In summer (e.g. July), `Europe/Dublin` operates on IST (UTC+1). Because IST is standard time, `dst?` returns `false`, `std_offset` is `0`, `utc_offset` is `3600`, and `utc_total_offset` is `3600` with abbreviation `"IST"`.
- In winter (e.g. January), `Europe/Dublin` operates on GMT (UTC+0). IANA tzdata models this as a negative daylight saving offset: `dst?` returns `true`, `std_offset` is `-3600`, `utc_offset` is `3600`, and `utc_total_offset` is `0` with abbreviation `"GMT"`.
#### How the Wrong Expectation Fails
A common expectation is that winter represents standard time (`dst? == false`, offset +0) and summer represents daylight saving time (`dst? == true`, offset +1h). Any application code or test that relies on `period.dst?` to indicate whether a summer clock advance is active will fail inverted checks on Dublin timestamps, incorrectly identifying January as daylight saving time and July as standard time.
### 2. 30-Minute Daylight Saving Shifts (Australia/Lord_Howe)
While most DST transitions shift wall clocks by 3600 seconds (1 hour), `Australia/Lord_Howe` shifts by 1800 seconds (30 minutes):
- Winter standard time: `utc_offset = 37800` (UTC+10:30), `std_offset = 0`, `dst? = false`, total offset `37800` (`"+1030"`).
- Summer DST: `utc_offset = 37800`, `std_offset = 1800` (+30 minutes), `dst? = true`, total offset `39600` (UTC+11:00, `"+11"`).
### 3. Fractional 45-Minute UTC Base Offsets (Asia/Kathmandu)
`Asia/Kathmandu` operates on a fixed 45-minute fractional base offset:
- `utc_offset = 20700` (UTC+05:45), `std_offset = 0`, `dst? = false`, total offset `20700` (`"+0545"`).
### 4. Country Zone Coordinates as Exact Rational Fractions
Calling `TZInfo::Country.get("AF").zone_info.first` returns a `TZInfo::CountryTimezone` instance where `latitude` (`2071/60`) and `longitude` (`346/5`) are instances of `Rational` rather than `Float`. This preserves exact degree and arc-minute definitions from the IANA database without floating-point precision loss.
### 5. Lazy Loading of Definition Modules
`TZInfo::DataSources::RubyDataSource` does not load all timezone definitions upfront. When `require "tzinfo/data"` is called, definition modules under `TZInfo::Data::Definitions` remain undefined. Querying a timezone via `TZInfo::Timezone.get("Pacific/Kiritimati")` dynamically requires its file, defining `TZInfo::Data::Definitions::Pacific::Kiritimati` at runtime.
{"case":{"believed":"In European timezones such as Europe/Dublin, winter periods are standard time with dst? returning false and summer periods are daylight saving time with dst? returning true.","caseId":"case:sha256:aa1cd6a92d526de299ed4d6bd7118d6827225e99050ca399dac4e15f6faca4b1","contract":["In Europe/Dublin under tzdata 2026c, winter periods have dst? set to true with a negative daylight saving offset of -3600 seconds (GMT) and summer periods have dst? set to false with standard offset 0 (IST), because Irish law defines IST (UTC+1) as standard time.","Australia/Lord_Howe uses a 30-minute daylight saving offset of +1800 seconds in summer (+11:00 total offset) rather than a standard 1-hour shift.","Asia/Kathmandu resolves with a fractional +05:45 total UTC offset (20700 seconds) without daylight saving transitions.","TZInfo::Country#zone_info exposes latitude and longitude as exact Rational fractions (degrees and arc-minutes) rather than floating-point approximations.","Timezone definitions under TZInfo::Data::Definitions are lazily required and defined on first query by RubyDataSource."],"goal":"Handle Irish negative daylight saving time in Europe/Dublin and fractional timezone offsets via tzinfo-data 1.2026.3 RubyDataSource","kind":"HOW","packages":["pkg:gem/tzinfo-data@1.2026.3"],"schemaVersion":1,"symbols":["TZInfo::Data","TZInfo::DataSources::RubyDataSource","TZInfo::Timezone#period_for_utc","TZInfo::Country#zone_info"]},"contractCommand":["ruby","test/contract.rb"],"environment":{"arch":"x64","ecosystem":"gem","executionContext":"ruby","language":"ruby","os":"linux","packageManager":"bundler","runtime":"ruby","schemaVersion":1},"license":"MIT-0","packages":["pkg:gem/tzinfo-data@1.2026.3"],"schemaVersion":1,"symbols":["TZInfo::Data","TZInfo::DataSources::RubyDataSource","TZInfo::Timezone#period_for_utc","TZInfo::Country#zone_info"],"verifierAdapter":"rubygems@1"}
# frozen_string_literal: true
require "bundler/setup"
require "tzinfo"
require "tzinfo/data"
def assert(condition, message = "Assertion failed")
raise message unless condition
end
# 1. Version and datasource setup
assert(TZInfo::Data::VERSION == "1.2026.3", "Unexpected TZInfo::Data::VERSION: #{TZInfo::Data::VERSION}")
assert(TZInfo::Data::Version::STRING == "1.2026.3", "Unexpected Version::STRING: #{TZInfo::Data::Version::STRING}")
assert(TZInfo::Data::Version::TZDATA == "2026c", "Unexpected Version::TZDATA: #{TZInfo::Data::Version::TZDATA}")
assert(TZInfo::Data::Version::FORMAT == 1, "Unexpected Version::FORMAT: #{TZInfo::Data::Version::FORMAT}")
TZInfo::DataSource.set(:ruby)
data_source = TZInfo::DataSource.get
assert(data_source.is_a?(TZInfo::DataSources::RubyDataSource), "DataSource is not RubyDataSource: #{data_source.class}")
# 2. Negative DST handling: Europe/Dublin standard time is IST (+1h), winter GMT is negative DST (-1h)
dublin = TZInfo::Timezone.get("Europe/Dublin")
# Winter in Dublin: GMT (UTC+0), standard offset is -3600s, dst? is true
winter_dublin = dublin.period_for_utc(Time.utc(2026, 1, 15, 12, 0, 0))
assert(winter_dublin.dst? == true, "Expected Dublin winter period to have dst? == true (negative DST)")
assert(winter_dublin.std_offset == -3600, "Expected Dublin winter std_offset == -3600, got #{winter_dublin.std_offset}")
assert(winter_dublin.utc_offset == 3600, "Expected Dublin winter base utc_offset == 3600, got #{winter_dublin.utc_offset}")
assert(winter_dublin.utc_total_offset == 0, "Expected Dublin winter total offset == 0, got #{winter_dublin.utc_total_offset}")
assert(winter_dublin.abbr == "GMT", "Expected Dublin winter abbreviation to be GMT, got #{winter_dublin.abbr}")
# Summer in Dublin: IST (UTC+1), standard offset is 0, dst? is false
summer_dublin = dublin.period_for_utc(Time.utc(2026, 7, 15, 12, 0, 0))
assert(summer_dublin.dst? == false, "Expected Dublin summer period to have dst? == false (standard time IST)")
assert(summer_dublin.std_offset == 0, "Expected Dublin summer std_offset == 0, got #{summer_dublin.std_offset}")
assert(summer_dublin.utc_offset == 3600, "Expected Dublin summer base utc_offset == 3600, got #{summer_dublin.utc_offset}")
assert(summer_dublin.utc_total_offset == 3600, "Expected Dublin summer total offset == 3600, got #{summer_dublin.utc_total_offset}")
assert(summer_dublin.abbr == "IST", "Expected Dublin summer abbreviation to be IST, got #{summer_dublin.abbr}")
# 3. Partial-hour DST jump in Australia/Lord_Howe (30-minute shift: +10:30 to +11:00)
lord_howe = TZInfo::Timezone.get("Australia/Lord_Howe")
# Winter standard time: +10:30 (37800s)
lh_winter = lord_howe.period_for_utc(Time.utc(2026, 7, 15, 12, 0, 0))
assert(lh_winter.dst? == false, "Lord Howe winter should not be DST")
assert(lh_winter.std_offset == 0, "Expected 0 standard offset in Lord Howe winter")
assert(lh_winter.utc_offset == 37_800, "Expected 37800s base offset (+10:30), got #{lh_winter.utc_offset}")
assert(lh_winter.utc_total_offset == 37_800, "Expected 37800s total offset, got #{lh_winter.utc_total_offset}")
assert(lh_winter.abbr == "+1030", "Expected +1030 abbreviation, got #{lh_winter.abbr}")
# Summer DST: +11:00 (39600s), where std_offset is 1800s (+30 minutes)
lh_summer = lord_howe.period_for_utc(Time.utc(2026, 1, 15, 12, 0, 0))
assert(lh_summer.dst? == true, "Lord Howe summer should be DST")
assert(lh_summer.std_offset == 1800, "Expected 1800s (+30 min) DST offset, got #{lh_summer.std_offset}")
assert(lh_summer.utc_offset == 37_800, "Expected 37800s base offset, got #{lh_summer.utc_offset}")
assert(lh_summer.utc_total_offset == 39_600, "Expected 39600s total offset (+11:00), got #{lh_summer.utc_total_offset}")
assert(lh_summer.abbr == "+11", "Expected +11 abbreviation, got #{lh_summer.abbr}")
# 4. 45-minute fractional timezone (Asia/Kathmandu: UTC+05:45)
kathmandu = TZInfo::Timezone.get("Asia/Kathmandu")
ktm_period = kathmandu.period_for_utc(Time.utc(2026, 6, 1, 12, 0, 0))
assert(ktm_period.utc_total_offset == 20_700, "Expected 20700s offset (+05:45), got #{ktm_period.utc_total_offset}")
assert(ktm_period.abbr == "+0545", "Expected +0545 abbreviation, got #{ktm_period.abbr}")
assert(ktm_period.dst? == false, "Kathmandu should not observe DST")
# 5. Exact Rational coordinates in country timezone metadata
afghanistan = TZInfo::Country.get("AF")
kabul_zone = afghanistan.zone_info.first
assert(kabul_zone.identifier == "Asia/Kabul", "Expected Asia/Kabul zone identifier")
assert(kabul_zone.latitude.is_a?(Rational), "Expected Rational latitude, got #{kabul_zone.latitude.class}")
assert(kabul_zone.longitude.is_a?(Rational), "Expected Rational longitude, got #{kabul_zone.longitude.class}")
assert(kabul_zone.latitude == Rational(2071, 60), "Expected latitude Rational(2071, 60), got #{kabul_zone.latitude}")
assert(kabul_zone.longitude == Rational(346, 5), "Expected longitude Rational(346, 5), got #{kabul_zone.longitude}")
# 6. Lazy-loading definition modules in RubyDataSource
assert(defined?(TZInfo::Data::Definitions::Pacific::Kiritimati).nil?, "Kiritimati module should not be loaded before query")
kiritimati = TZInfo::Timezone.get("Pacific/Kiritimati")
assert(defined?(TZInfo::Data::Definitions::Pacific::Kiritimati) == "constant", "Kiritimati module should be loaded after query")
kiri_period = kiritimati.period_for_utc(Time.utc(2026, 1, 1, 12, 0, 0))
assert(kiri_period.utc_total_offset == 50_400, "Expected +50400s (+14:00) offset for Kiritimati, got #{kiri_period.utc_total_offset}")
assert(kiri_period.abbr == "+14", "Expected +14 abbreviation, got #{kiri_period.abbr}")
puts "CONTRACT PASS: tzinfo-data 1.2026.3 negative DST, fractional offsets, Rational coordinates, and lazy definitions verified"