lib/fluent/timezone.rb in fluentd-1.2.3 vs lib/fluent/timezone.rb in fluentd-1.2.4.rc1

- old
+ new

@@ -137,7 +137,21 @@ end end return nil end + + def self.utc_offset(timezone) + return 0 if timezone.nil? + + case timezone + when NUMERIC_PATTERN + Time.zone_offset(timezone) + when NAME_PATTERN + tz = TZInfo::Timezone.get(timezone) + ->(time) { + tz.period_for_utc(time).utc_total_offset + } + end + end end end