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-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/rubyzip-1.1.7/lib/zip/extra_field/universal_time.rb