diff --git a/lib/net/sftp/protocol/04/attributes.rb b/lib/net/sftp/protocol/04/attributes.rb index 3a943fd..02bde71 100644 --- a/lib/net/sftp/protocol/04/attributes.rb +++ b/lib/net/sftp/protocol/04/attributes.rb @@ -134,6 +134,15 @@ def prepare_serialization! # were given on instantiation owner group + + # The subsecond flag applies to every timestamp present in the packet. + subseconds = self.class.elements.select { |_name, _type, flags| flags & F_SUBSECOND_TIMES != 0 } + if subseconds.any? { |name, _type, _flags| attributes[name] } + subseconds.each do |name, _type, _flags| + seconds = name.to_s.sub(/_nseconds\z/, "").to_sym + attributes[name] ||= 0 if attributes[seconds] + end + end end # Performs protocol-version-specific encoding of the access control