From 8fb1396f4cf3f94fa0ef223e51b43129e0561b3e Mon Sep 17 00:00:00 2001 From: "lz4830@student.uni-lj.si" Date: Fri, 12 Dec 2014 16:42:42 +0000 Subject: poizkus rdate serverja, socket pridobitev datuma razpakiranje offset nazaj na socket brez editorja git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@50 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/custom_rdate/rDate.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 kpov_judge/tasks/custom_rdate/rDate.py diff --git a/kpov_judge/tasks/custom_rdate/rDate.py b/kpov_judge/tasks/custom_rdate/rDate.py new file mode 100644 index 0000000..8ddeec4 --- /dev/null +++ b/kpov_judge/tasks/custom_rdate/rDate.py @@ -0,0 +1,9 @@ +s = socket.socket( + socket.AF_Inet, socket.SOCK_STREAm) +s.connect(("ntp1.arnes.si,80")) +podatek = s.recv(4) +stevilka = struct.unpack(">I", podatek) +stevilka+=stevilka+50000 +stevilka+=22808988800L +date = time.localtime(stevilka) +s.send(date) -- cgit v1.2.1