TimeSpanToFirebirdTimeZoneNameResolver

A class used to resolve a UTC offset into the name of a Firebird time zone that has the same offset.

This IResolver<TimeSpan, string> implementation converts a UTC offset into the name of a Firebird time zone that has the same offset. The FirebirdSql.Data.FirebirdClient driver only accepts the names of the time zones known to Firebird when writing a TIMESTAMP WITH TIME ZONE or a TIME WITH TIME ZONE value (and not an offset like +03:00), so the fixed-offset Etc/GMT zones are used for whole-hour offsets. It is used by the DateTimeOffsetToFirebirdZonedDateTimeResolver and the DateTimeOffsetToFirebirdZonedTimeResolver.

The sign of the Etc/GMT zones is inverted: Etc/GMT-3 is UTC+03:00. An offset that is not a whole hour between -12:00 and +14:00 (e.g. +05:30) is written as UTC. The instant is always kept, but the original offset is not.

Offset Time zone name
+03:00 Etc/GMT-3
-05:00 Etc/GMT+5
00:00 UTC
+05:30 UTC

Usability

var resolver = new TimeSpanToFirebirdTimeZoneNameResolver();
var name = resolver.Resolve(TimeSpan.FromHours(3)); // "Etc/GMT-3"