30 lines
602 B
Python
30 lines
602 B
Python
#!/usr/bin/env python3
|
|
from datetime import datetime
|
|
import zmq
|
|
|
|
|
|
DATETIMES=[]
|
|
|
|
|
|
context = zmq.Context()
|
|
socket = context.socket(zmq.SUB)
|
|
socket.connect("tcp://127.0.0.1:5559")
|
|
|
|
socket.setsockopt_string(zmq.SUBSCRIBE, "test")
|
|
|
|
try:
|
|
while True:
|
|
m = socket.recv_string()
|
|
DATETIMES.append(datetime.now())
|
|
except KeyboardInterrupt:
|
|
dt = {}
|
|
for datetime in DATETIMES:
|
|
dts = datetime.strftime("%m/%d/%Y, %H:%M:%S")
|
|
if dts not in dt:
|
|
dt[dts] = 1
|
|
else:
|
|
dt[dts] +=1
|
|
for key in dt:
|
|
print(key,",",dt[key])
|
|
socket.close()
|