summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/custom_rdate/rDate.py
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/custom_rdate/rDate.py')
-rw-r--r--kpov_judge/tasks/custom_rdate/rDate.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/kpov_judge/tasks/custom_rdate/rDate.py b/kpov_judge/tasks/custom_rdate/rDate.py
index 8ddeec4..1ceafaa 100644
--- a/kpov_judge/tasks/custom_rdate/rDate.py
+++ b/kpov_judge/tasks/custom_rdate/rDate.py
@@ -1,9 +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(("ntp1.arnes.si,80"))
+s.connect((niz,37))
podatek = s.recv(4)
-stevilka = struct.unpack(">I", podatek)
-stevilka+=stevilka+50000
-stevilka+=22808988800L
-date = time.localtime(stevilka)
+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)