Class: Zip::ZipExtraField::UniversalTime

### Home Classes Methods

### In Files

- lib/zip/zip_extra_field.rb

### Parent

Zip::ZipExtraField::Generic

### Methods

- ::new
- #==
- #merge
- #pack_for_c_dir
- #pack_for_local

### Class/Module Index

Quicksearch

- Zip
- Zip::ZipCentralDirectory
- Zip::ZipCompressionMethodError
- Zip::ZipDestinationFileExistsError
- Zip::ZipEntry
- Zip::ZipEntryExistsError
- Zip::ZipEntryNameError
- Zip::ZipError
- Zip::ZipExtraField
- Zip::ZipExtraField::Generic
- Zip::ZipExtraField::IUnix
- Zip::ZipExtraField::UniversalTime
- Zip::ZipFile
- Zip::ZipFileSystem
- Zip::ZipFileSystem::ZipFsDir
- Zip::ZipFileSystem::ZipFsFile
- Zip::ZipFileSystem::ZipFsFile::ZipFsStat
- Zip::ZipInputStream
- Zip::ZipInternalError
- Zip::ZipOutputStream
- Zip::ZipStreamableDirectory
- Zip::ZipStreamableStream
- IOExtras
- IOExtras::AbstractInputStream
- IOExtras::AbstractOutputStream
- IOExtras::FakeIO
- BugFix
- Object

No matching classes.

# Zip::ZipExtraField::UniversalTime

Info-ZIP Additional timestamp field

### Constants

HEADER_ID

### Attributes

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

### Public Class Methods

new(binstr = nil) click to toggle source

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

### Public Instance Methods

==(other) click to toggle source

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

merge(binstr) click to toggle source

    # File lib/zip/zip_extra_field.rb, line 62
    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 ||= DOSTime.at(mtime)
      atime and @atime ||= DOSTime.at(atime)
      ctime and @ctime ||= DOSTime.at(ctime)
    end

pack_for_c_dir() click to toggle source

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

pack_for_local() click to toggle source

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

Generated with the Darkfish Rdoc Generator 2.