# File lib/archive/zip/entry.rb, line 558
    def add_extra_field(extra_field)
      # Try to find an extra field with the same header ID already in the list
      # and merge the new one with that if one exists; otherwise, add the new
      # one to the list.
      existing_extra_field = @extra_fields.find do |ef|
        ef.header_id == extra_field.header_id
      end
      if existing_extra_field.nil? then
        @extra_fields << extra_field
      else
        extra_field = existing_extra_field.merge(extra_field)
      end

      # Set some attributes of this entry based on the settings in select types
      # of extra fields.
      if extra_field.kind_of?(ExtraField::ExtendedTimestamp) then
        self.mtime = extra_field.mtime unless extra_field.mtime.nil?
        self.atime = extra_field.atime unless extra_field.atime.nil?
      elsif extra_field.kind_of?(ExtraField::Unix) then
        self.mtime = extra_field.mtime unless extra_field.mtime.nil?
        self.atime = extra_field.atime unless extra_field.atime.nil?
        self.uid   = extra_field.uid unless extra_field.uid.nil?
        self.gid   = extra_field.gid unless extra_field.uid.nil?
      end
      self
    end