Calculate seconds since EPOCH from days and milliseconds for each of IASI scan.
432166
def _form_datetimes(days, msecs):
    """"""

    all_datetimes = []
    for i in range(days.size):
        day = int(days[i])
        msec = msecs[i]
        scanline_datetimes = []
        for j in range(int(VALUES_PER_SCAN_LINE / 4)):
            usec = 1000 * (j * VIEW_TIME_ADJUSTMENT + msec)
            delta = (dt.timedelta(days=day, microseconds=usec))
            for k in range(4):
                scanline_datetimes.append(delta.total_seconds())
        all_datetimes.append(scanline_datetimes)

    return np.array(all_datetimes, dtype=np.float64)
1340457
def micros_to_timestamp(micros, timestamp):
  
  seconds = long(micros / _MICROS_PER_SECOND)
  micro_remainder = micros % _MICROS_PER_SECOND
  timestamp.seconds = seconds
  timestamp.nanos = micro_remainder * _NANOS_PER_MICRO
575687
def i2repr(self, pkt, packed_seconds):
        """"""
        time_struct = time.gmtime(self._convert_seconds(packed_seconds))
        return time.strftime("%a %b %d %H:%M:%S %Y", time_struct)
1149848
def timecds2datetime(tcds):
    

    days = int(tcds['Days'])
    milliseconds = int(tcds['Milliseconds'])
    try:
        microseconds = int(tcds['Microseconds'])
    except (KeyError, ValueError):
        microseconds = 0
    try:
        microseconds += int(tcds['Nanoseconds']) / 1000.
    except (KeyError, ValueError):
        pass

    reference = datetime(1958, 1, 1)
    delta = timedelta(days=days, milliseconds=milliseconds,
                      microseconds=microseconds)

    return reference + delta
1027266
def clock(seg, seconds):
    
    interval = 0.5
    for i in range(int(seconds / interval)):
        now = datetime.now()
        seg.text = now.strftime("%H-%M-%S")

        # calculate blinking dot
        if i % 2 == 0:
            seg.text = now.strftime("%H-%M-%S")
        else:
            seg.text = now.strftime("%H %M %S")

        time.sleep(interval)
182992
def from_unix(cls, seconds, milliseconds=0):
        
        base = list(time.gmtime(seconds))[0:6]
        base.append(milliseconds * 1000)  # microseconds
        return cls(*base)
337581
def st_ctime(self):
        """"""
        ctime = self._st_ctime_ns / 1e9
        return ctime if self.use_float else int(ctime)
1150611
def _get_date(data, position, dummy, opts):
    """"""
    end = position + 8
    millis = _UNPACK_LONG(data[position:end])[0]
    diff = ((millis % 1000) + 1000) % 1000
    seconds = (millis - diff) / 1000
    micros = diff * 1000
    if opts.tz_aware:
        return EPOCH_AWARE + datetime.timedelta(
            seconds=seconds, microseconds=micros), end
    else:
        return EPOCH_NAIVE + datetime.timedelta(
            seconds=seconds, microseconds=micros), end
330873
def total_seconds(td):
  
  secs = td.seconds + td.days * 24 * 3600
  if td.microseconds:
    secs += 1
  return secs
1316487
def duration(seconds):
    """"""
    if seconds < 1:
        return 'less than 1 sec'
    seconds = int(round(seconds))
    components = []
    for magnitude, label in ((3600, 'hr'), (60, 'min'), (1, 'sec')):
        if seconds >= magnitude:
            components.append('{} {}'.format(seconds // magnitude, label))
            seconds %= magnitude
    return ' '.join(components)
550827
def tick(self):
        """"""
        now = datetime.datetime.now()
        self.add(now)

        # Create a list of timestamps, one for each period and
        # representing the beginning of that period (i.e. since now.)
        tstamps = [now - datetime.timedelta(seconds=xx)
                   for xx in self._periods]

        # Trim off any tick values older than the earliest timestamp.
        self.removeLT(min(tstamps))

        # Create a list of counts, one for each period and
        # representing the number of ticks in that period.
        counts = [self.getCountGT(xx) for xx in tstamps]

        # Compute a list of rates for the periods.
        rates = [float(xx)/yy for xx, yy in zip(counts, self._periods)]

        # Return the rates as a tuple.
        return tuple(rates)
776355
def _cmptimestamps(self, filest1, filest2):
        

        mtime_cmp = int((filest1.st_mtime - filest2.st_mtime) * 1000) > 0
        if self._use_ctime:
            return mtime_cmp or \
                   int((filest1.st_ctime - filest2.st_mtime) * 1000) > 0
        else:
            return mtime_cmp
1356474
def timedelta2millisecond(td):
    """"""
    milliseconds = td.days * 24 * 60 * 60 * 1000
    milliseconds += td.seconds * 1000
    milliseconds += td.microseconds / 1000
    return milliseconds
520917
def memorized_datetime(seconds):
    ''''''
    try:
        return _datetime_cache[seconds]
    except KeyError:
        # NB. We can't just do datetime.utcfromtimestamp(seconds) as this
        # fails with negative values under Windows (Bug #90096)
        dt = _epoch + timedelta(seconds=seconds)
        _datetime_cache[seconds] = dt
        return dt
312017
def unix_time(self, dt):
        
        epoch = datetime.utcfromtimestamp(0)
        delta = dt - epoch
        return int(delta.total_seconds())
169140
def ToDatetime(self):
    """"""
    return datetime.utcfromtimestamp(
        self.seconds + self.nanos / float(_NANOS_PER_SECOND))
1204019
def human_time(seconds):
	''' 
	'''
	isec = int(seconds)
	s = isec % 60
	m = isec // 60 % 60
	h = isec // 60 // 60 % 24
	d = isec // 60 // 60 // 24 % 7
	w = isec // 60 // 60 // 24 // 7

	result = ''
	for t in [ ('W', w), ('D', d), ('h', h), ('m', m), ('s', s) ]:
		if t[1]:
			result += str(t[1]) + t[0]

	return result