diff options
Diffstat (limited to 'tasks/custom_rdate/rDate.py')
-rw-r--r-- | tasks/custom_rdate/rDate.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tasks/custom_rdate/rDate.py b/tasks/custom_rdate/rDate.py new file mode 100644 index 0000000..97885b0 --- /dev/null +++ b/tasks/custom_rdate/rDate.py @@ -0,0 +1,18 @@ + +#!/usr/bin/env python +#-*- coding utf-8 -*- + +import socket +import struct +import time + +niz=input("Vnesi IP ali ime strežnika:") +s = socket.socket( + socket.AF_Inet, socket.SOCK_STREAm) +s.connect((niz,37)) +podatek = s.recv(4) +stevilka = struct.unpack("!I", podatek) +st= stevilka[0]-220898800 +date = time.localtime(st) +print((time.strftime('%Y-%m-%d %H:%M:%S'), date)) +s.send(date) |