write delta, not end time
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
cb1e9aec54
commit
5d0580d930
1 changed files with 7 additions and 4 deletions
11
ctt.py
11
ctt.py
|
@ -56,19 +56,22 @@ class CTT:
|
||||||
|
|
||||||
start_seconds = self.start.strftime("%s")
|
start_seconds = self.start.strftime("%s")
|
||||||
stop_seconds = self.stop.strftime("%s")
|
stop_seconds = self.stop.strftime("%s")
|
||||||
|
|
||||||
|
delta_seconds = self.duration().total_seconds()
|
||||||
|
|
||||||
time_dir = os.path.join(self.project_dir, start_seconds)
|
time_dir = os.path.join(self.project_dir, start_seconds)
|
||||||
os.makedirs(time_dir, mode=0o700, exist_ok=True)
|
os.makedirs(time_dir, mode=0o700, exist_ok=True)
|
||||||
|
|
||||||
filename = os.path.join(time_dir, "end")
|
filename = os.path.join(time_dir, "delta")
|
||||||
|
|
||||||
with open(filename, "w") as fd:
|
with open(filename, "w") as fd:
|
||||||
fd.write("%s\n" % stop_seconds)
|
fd.write("%s\n" % delta_seconds)
|
||||||
|
|
||||||
def duration(self):
|
def delta(self):
|
||||||
if self.tracked_time:
|
if self.tracked_time:
|
||||||
delta = self.stop - self.start
|
delta = self.stop - self.start
|
||||||
else:
|
else:
|
||||||
delta = 0
|
delta = datetime.timedelta()
|
||||||
|
|
||||||
return delta
|
return delta
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue