Skip to content

Commit 09b73ae

Browse files
committed
changed reply message to use localtime instead of gmt; Thanks Ben Mason
1 parent 80e2b95 commit 09b73ae

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

raspiBot.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def command_003_pinOn(self, user, message, args):
6868
pin_num = args[1]
6969
GPIO.setup(int(pin_num), GPIO.OUT)
7070
GPIO.output(int(pin_num), True)
71-
self.replyMessage(user, "\nPin on: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
71+
self.replyMessage(user, "\nPin on: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
7272

7373
#This method turns off the specified GPIO pin
7474
def command_003_pinOff(self, user, message, args):
@@ -77,7 +77,7 @@ def command_003_pinOff(self, user, message, args):
7777
pin_num = args[1]
7878
GPIO.setup(int(pin_num), GPIO.OUT)
7979
GPIO.output(int(pin_num), False)
80-
self.replyMessage(user, "\nPin off: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
80+
self.replyMessage(user, "\nPin off: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
8181

8282
#This method writes to the specified GPIO pin
8383
def command_003_write(self, user, message, args):
@@ -90,10 +90,10 @@ def command_003_write(self, user, message, args):
9090

9191
if int(state) == 1:
9292
GPIO.output(int(pin_num), True)
93-
self.replyMessage(user, "Pin on: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
93+
self.replyMessage(user, "Pin on: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
9494
elif int(state) == 0:
9595
GPIO.output(int(pin_num), False)
96-
self.replyMessage(user, "Pin off: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
96+
self.replyMessage(user, "Pin off: "+ pin_num +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
9797

9898
#This method reads the value of the specified GPIO pin
9999
def command_003_read(self, user, message, args):
@@ -102,7 +102,7 @@ def command_003_read(self, user, message, args):
102102
pin_num = args[1]
103103
GPIO.setup(int(pin_num), GPIO.IN)
104104
pin_value = GPIO.input(int(pin_num))
105-
self.replyMessage(user, "\nPin read: "+ pin_num + " value: " + str(pin_value) + " at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
105+
self.replyMessage(user, "\nPin read: "+ pin_num + " value: " + str(pin_value) + " at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
106106

107107
#This executes the shell command argument after 'shell' or 'bash'
108108
def command_003_shell(self, user, message, args):
@@ -114,12 +114,12 @@ def command_003_shell(self, user, message, args):
114114
output += line
115115
print line,
116116
retval = p.wait()
117-
self.replyMessage(user, output +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
117+
self.replyMessage(user, output +" at: "+time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
118118

119119
#This method is the default response
120120
def command_100_default(self, user, message, args):
121121
'''.*?(?s)(?m)'''
122-
self.replyMessage(user, time.strftime("%Y-%m-%d %a %H:%M:%S", time.gmtime()))
122+
self.replyMessage(user, time.strftime("%Y-%m-%d %a %H:%M:%S", time.localtime()))
123123

124124
############################################################################################################################
125125
if __name__ == "__main__":

0 commit comments

Comments
 (0)