added Command.__str__(), setting the_time with relative time offset
This commit is contained in:
parent
2982469274
commit
cc54eb8883
10
Command.py
10
Command.py
@ -6,8 +6,13 @@ class Command:
|
||||
def __init__(self, timenow, cmdline):
|
||||
self.time = timenow
|
||||
self.command = 'start'
|
||||
self.argstr = ''
|
||||
self.parseCommandLine(cmdline)
|
||||
|
||||
def __str__(self):
|
||||
return "{'time' => %s, 'command' => %s, 'argstr' => %s}" % \
|
||||
(self.time, self.command, self.argstr)
|
||||
|
||||
def parseCommandLine(self, cmdline):
|
||||
COMMANDS = {
|
||||
'out' : 1,
|
||||
@ -65,3 +70,8 @@ class Command:
|
||||
seconds = m.group(2)
|
||||
else: # hours
|
||||
seconds = m.group(2) * 60 * 60
|
||||
delta = datetime.timedelta(seconds = seconds)
|
||||
if plus_minus == '-':
|
||||
the_time -= delta
|
||||
else:
|
||||
the_time += delta
|
||||
|
Loading…
x
Reference in New Issue
Block a user