Example #1
0
def durationWin64(field):
    """
    Convert Windows 64-bit duration to string. The timestamp format is
    a 64-bit number: number of 100ns. See also timestampWin64().

    >>> durationWin64(type("", (), dict(value=2146280000, size=64)))
    u'3 min 34 sec 628 ms'
    >>> durationWin64(type("", (), dict(value=(1 << 64)-1, size=64)))
    u'58494 years 88 days 5 hours'
    """
    assert hasattr(field, "value") and hasattr(field, "size")
    assert field.size == 64
    delta = doDurationWin64(field.value)
    return humanDuration(delta)
Example #2
0
 def createDescription(self):
     tag = self["type"].value
     if tag == "AVI ":
         desc = u"Microsoft AVI video"
         if "headers/avi_hdr" in self:
             header = self["headers/avi_hdr"]
             desc += ": %ux%u pixels" % (header["width"].value, header["height"].value)
             microsec = header["microsec_per_frame"].value
             if microsec:
                 desc += ", %.1f fps" % (1000000.0 / microsec)
                 if "total_frame" in header and header["total_frame"].value:
                     delta = timedelta(seconds=float(header["total_frame"].value) * microsec)
                     desc += ", " + humanDuration(delta)
         return desc
     else:
         try:
             return self.VALID_TYPES[tag][2]
         except KeyError:
             return u"Microsoft RIFF container"
Example #3
0
def diff(field):
    return humanDuration(field.value * 1000)
Example #4
0
 def computeLength(self, field):
     try:
         ms = int(field.value)
         return humanDuration(ms)
     except:
         return field.value
Example #5
0
 def computeLength(self, field):
     try:
         ms = int(field.value)
         return humanDuration(ms)
     except:
         return field.value
Example #6
0
def diff(field):
    return humanDuration(field.value*1000)
Example #7
0
 def createDisplay(self):
     return humanDuration(self.value)
Example #8
0
def formatJiffie(field):
    sec = float(field.value) / 60
    return humanDuration(timedelta(seconds=sec))
Example #9
0
 def createDisplay(self):
     return humanDuration(self.value)
Example #10
0
 def postMaxTime(self, chunk):
     return humanDuration(chunk.value * 1000)
Example #11
0
def formatJiffie(field):
    sec = float(field.value) / 60
    return humanDuration(timedelta(seconds=sec))