class Zip::DOSTime

:nodoc:all

def self.from_time(time)

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(bin_dos_date, bin_dos_time)

def self.parse_binary_dos_format(bin_dos_date, bin_dos_time)
  second = 2 * (0b11111 & bin_dos_time)
  minute = (0b11111100000 & bin_dos_time) >> 5
  hour   = (0b1111100000000000 & bin_dos_time) >> 11
  day    = (0b11111 & bin_dos_date)
  month  = (0b111100000 & bin_dos_date) >> 5
  year   = ((0b1111111000000000 & bin_dos_date) >> 9) + 1980
  begin
    local(year, month, day, hour, minute, second)
  end
end

def dos_equals(other)

Dos time is only stored with two seconds accuracy
def dos_equals(other)
  to_i / 2 == other.to_i / 2
end

def to_binary_dos_date

def to_binary_dos_date
  day +
    (month << 5) +
    ((year - 1980) << 9)
end

def to_binary_dos_time

def to_binary_dos_time
  (sec / 2) +
    (min << 5) +
    (hour << 11)
end