Add a convenience method for creating DOSTime instances.
DOSTime::from_time creates a DOSTime instance from a vanilla Time instance.
This commit is contained in:
parent
8c694d38ee
commit
2bdd37d894
|
@ -29,6 +29,11 @@ module Zip
|
|||
to_i / 2 == other.to_i / 2
|
||||
end
|
||||
|
||||
# Create a DOSTime instance from a vanilla Time instance.
|
||||
def self.from_time(time)
|
||||
local(time.year, time.month, time.day, time.hour, time.min, time.sec)
|
||||
end
|
||||
|
||||
def self.parse_binary_dos_format(binaryDosDate, binaryDosTime)
|
||||
second = 2 * (0b11111 & binaryDosTime)
|
||||
minute = (0b11111100000 & binaryDosTime) >> 5
|
||||
|
|
|
@ -406,9 +406,7 @@ module Zip
|
|||
@unix_uid = stat.uid
|
||||
@unix_gid = stat.gid
|
||||
@unix_perms = stat.mode & 0o7777
|
||||
|
||||
mtime = stat.mtime
|
||||
@time = ::Zip::DOSTime.local(mtime.year, mtime.month, mtime.day, mtime.hour, mtime.min, mtime.sec)
|
||||
@time = ::Zip::DOSTime.from_time(stat.mtime)
|
||||
end
|
||||
|
||||
def set_unix_attributes_on_path(dest_path)
|
||||
|
|
Loading…
Reference in New Issue