Commit dae5d812 authored by Antoine Millet's avatar Antoine Millet
Browse files

Now return timestamp for datetimes in export.

parent 08baf687
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ class BaseJob(dict, Thread, object):
            raise JobError('Job is done')
        if self['cancelled']:
            raise JobError('Job is already cancelled')

        self['cancelled'] = True
        self.report('cancelling')

@@ -168,17 +169,15 @@ class BaseJob(dict, Thread, object):
            if key.startswith('_') or (props is not None and key not in props):
                continue
            if isinstance(val, datetime):
                now = datetime.now()
                dt = now - val
                val = dt.seconds + dt.days * 86400
                val = int(time.mktime(val.timetuple()))

            if key == 'duration':
                if self['done']:
                    dt = self['ended'] - self['started']
                    dt = self['ended'] - self['created']
                    val = dt.seconds + dt.days * 86400
                else:
                    now = datetime.now()
                    dt = now - self['started']
                    dt = now - self['created']
                    val = dt.seconds + dt.days * 86400

            exported[key] = str(val)