We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 126858b commit 1a6fa2fCopy full SHA for 1a6fa2f
1 file changed
scan/client/scaninfo.py
@@ -5,6 +5,7 @@
5
6
@author: Kay Kasemir
7
"""
8
+from datetime import datetime
9
10
class ScanInfo(object):
11
"""Information about a scan
@@ -30,14 +31,16 @@ def __init__(self, xml):
30
31
def isDone(self):
32
""":return: `True` if scan has completed, successful or not"""
33
return not (self.state in ( 'Idle', 'Running', 'Paused' ))
-
34
+
35
def percentage(self):
36
""":return: Percent of work done, 0...100"""
37
if self.total_work_units <= 0:
38
return 0;
39
return int(self.performed_work_units * 100 / self.total_work_units);
40
- # TODO Methods to convert raw seconds into time stamps
41
+ def createdDatetime(self):
42
+ """:return: datetime when scan was created"""
43
+ return datetime.fromtimestamp(self.created / 1000)
44
45
# TODO Turn id, name, ... into @property?
46
0 commit comments