Class Zip::ZipExtraField::UniversalTime
In: lib/zip/zip.rb
Parent: Generic

Info-ZIP Additional timestamp field

Methods

==   merge   new   pack_for_c_dir   pack_for_local  

Constants

HEADER_ID = "UT"

Attributes

atime  [RW] 
ctime  [RW] 
flag  [RW] 
mtime  [RW] 

Public Class methods

[Source]

# File lib/zip/zip.rb, line 1717
      def initialize(binstr = nil)
        @ctime = nil
        @mtime = nil
        @atime = nil
        @flag  = nil
        binstr and merge(binstr)
      end

Public Instance methods

[Source]

# File lib/zip/zip.rb, line 1736
      def ==(other)
        @mtime == other.mtime &&
        @atime == other.atime &&
        @ctime == other.ctime
      end

[Source]

# File lib/zip/zip.rb, line 1726
      def merge(binstr)
        binstr == "" and return
        size, content = initial_parse(binstr)
        size or return
        @flag, mtime, atime, ctime = content.unpack("CVVV")
        mtime and @mtime ||= Time.at(mtime)
        atime and @atime ||= Time.at(atime)
        ctime and @ctime ||= Time.at(ctime)
      end

[Source]

# File lib/zip/zip.rb, line 1750
      def pack_for_c_dir
        s = [@flag].pack("C")
        @flag & 1 == 1 and s << [@mtime.to_i].pack("V")
        s
      end

[Source]

# File lib/zip/zip.rb, line 1742
      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

[Validate]