summaryrefslogtreecommitdiff
path: root/tasks/custom_rdate/rDate.py
blob: 97885b0804a8d11cd32b1b97a0eae8a583e065c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)