Generalize `Entry#time`.
So we can use it for `atime`, `ctime` and `utime` as well.
This commit is contained in:
parent
ae0262df2e
commit
d6482bd567
|
@ -118,16 +118,17 @@ module Zip
|
||||||
gp_flags & 8 == 8
|
gp_flags & 8 == 8
|
||||||
end
|
end
|
||||||
|
|
||||||
def time
|
def time(component: :mtime)
|
||||||
if @extra['UniversalTime'] && !@extra['UniversalTime'].mtime.nil?
|
time =
|
||||||
@extra['UniversalTime'].mtime
|
if @extra['UniversalTime']
|
||||||
elsif @extra['NTFS'] && !@extra['NTFS'].mtime.nil?
|
@extra['UniversalTime'].send(component)
|
||||||
@extra['NTFS'].mtime
|
elsif @extra['NTFS']
|
||||||
else
|
@extra['NTFS'].send(component)
|
||||||
# Standard time field in central directory has local time
|
end
|
||||||
# under archive creator. Then, we can't get timezone.
|
|
||||||
@time
|
# Standard time field in central directory has local time
|
||||||
end
|
# under archive creator. Then, we can't get timezone.
|
||||||
|
time || (@time if component == :mtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
alias mtime time
|
alias mtime time
|
||||||
|
|
Loading…
Reference in New Issue