aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2017-03-30 21:07:45 +0300
committerJan Tuomi <jans.tuomi@gmail.com>2017-03-30 21:07:45 +0300
commit73e1db4ea519fffb5f4c23d3bc348ee5f15f14a3 (patch)
tree383cd1ec2aed7978d0a9be2fee7351402c5acaaf
parentad354278c38e7aace7d3738988ac613a6fece61f (diff)
Add timestamps to inbound messages
-rwxr-xr-xclient.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/client.py b/client.py
index 682457f..f89112c 100755
--- a/client.py
+++ b/client.py
@@ -7,6 +7,8 @@ Created on 29.3.2017
import socket
import time
+from time import gmtime, strftime
+
import threading
import signal
from datetime import datetime
@@ -72,7 +74,8 @@ def listen_messages():
debug(username)
debug(body)
if username != nick:
- print(username + ": " + body)
+ timestamp = strftime("%H:%M:%S", gmtime())
+ print("{} {}: {}".format(timestamp, username, body))
host = input("Host [{}]: ".format(DEFAULT_HOST))
nick = input("Nickname [{}]: ".format(DEFAULT_NICK))