Sha256: 5e7bf9c628ce4b9e81259552ee3637726e0cd205f1e397ba9ce6f004f7c01d01

Contents?: true

Size: 1.14 KB

Versions: 82

Compression:

Stored size: 1.14 KB

Contents

module Zip
  # Info-ZIP Additional timestamp field
  class ExtraField::UniversalTime < ExtraField::Generic
    HEADER_ID = "UT"
    register_map

    def initialize(binstr = nil)
      @ctime = nil
      @mtime = nil
      @atime = nil
      @flag  = nil
      binstr and merge(binstr)
    end

    attr_accessor :atime, :ctime, :mtime, :flag

    def merge(binstr)
      return if binstr.empty?
      size, content = initial_parse(binstr)
      size or return
      @flag, mtime, atime, ctime = content.unpack("CVVV")
      mtime and @mtime ||= ::Zip::DOSTime.at(mtime)
      atime and @atime ||= ::Zip::DOSTime.at(atime)
      ctime and @ctime ||= ::Zip::DOSTime.at(ctime)
    end

    def ==(other)
      @mtime == other.mtime &&
        @atime == other.atime &&
        @ctime == other.ctime
    end

    def pack_for_local
      s = [@flag].pack("C")
      @flag & 1 != 0 and s << [@mtime.to_i].pack("V")
      @flag & 2 != 0 and s << [@atime.to_i].pack("V")
      @flag & 4 != 0 and s << [@ctime.to_i].pack("V")
      s
    end

    def pack_for_c_dir
      s = [@flag].pack("C")
      @flag & 1 == 1 and s << [@mtime.to_i].pack("V")
      s
    end
  end
end

Version data entries

82 entries across 79 versions & 21 rubygems

Version Path
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-htmlentities-0.1.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-base64-1.0.4 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-base64-1.0.3 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-delta-1.0.0 vendor/bundle/jruby/2.2.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-base64-1.0.2 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-base64-1.0.1 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-filter-base64-1.0.0 vendor/bundle/jruby/2.3.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb