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):
|
def __init__(self, timenow, cmdline):
|
||||||
self.time = timenow
|
self.time = timenow
|
||||||
self.command = 'start'
|
self.command = 'start'
|
||||||
|
self.argstr = ''
|
||||||
self.parseCommandLine(cmdline)
|
self.parseCommandLine(cmdline)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "{'time' => %s, 'command' => %s, 'argstr' => %s}" % \
|
||||||
|
(self.time, self.command, self.argstr)
|
||||||
|
|
||||||
def parseCommandLine(self, cmdline):
|
def parseCommandLine(self, cmdline):
|
||||||
COMMANDS = {
|
COMMANDS = {
|
||||||
'out' : 1,
|
'out' : 1,
|
||||||
@ -65,3 +70,8 @@ class Command:
|
|||||||
seconds = m.group(2)
|
seconds = m.group(2)
|
||||||
else: # hours
|
else: # hours
|
||||||
seconds = m.group(2) * 60 * 60
|
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