diff options
author | ap9176@student.uni-lj.si <ap9176@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-18 09:22:35 +0000 |
---|---|---|
committer | ap9176@student.uni-lj.si <ap9176@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-18 09:22:35 +0000 |
commit | e8f5555f274e108e14eb83612f95e05c00248bda (patch) | |
tree | 997ace5443e6e14ba21e081d392f7f84539e64f9 /kpov_judge | |
parent | 63c09795fbb552f0b838fd249264ede252d200a0 (diff) |
custom rdate dodana programa python/java in update howto
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@101 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge')
-rw-r--r-- | kpov_judge/tasks/custom_rdate/howtos/si/index.html | 6 | ||||
-rw-r--r-- | kpov_judge/tasks/custom_rdate/rDate.py | 19 |
2 files changed, 16 insertions, 9 deletions
diff --git a/kpov_judge/tasks/custom_rdate/howtos/si/index.html b/kpov_judge/tasks/custom_rdate/howtos/si/index.html index d2aeb5e..154dd17 100644 --- a/kpov_judge/tasks/custom_rdate/howtos/si/index.html +++ b/kpov_judge/tasks/custom_rdate/howtos/si/index.html @@ -29,15 +29,13 @@ na SimpleArbiterRDate pa z uporabnikom <strong>tester</strong> in geslom <strong JAVA------<br>
1. Z ukazom nano bintodec3.java ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano<br>
2. Napišemo program za pretvarjanje 32-bitnega števila v ÄŤas<br>
-<img src="slike/bu6.png"><br><img src="slike/bu7.png"><br>
3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.<br>
- 4. Če je še nimamo, naložimo Javo <strong>sudo apt-get install openjdk-6-jdk</strong><br><img src="slike/predvaja_clip_image003.gif"><br>
+ 4. Če je še nimamo, naložimo Javo <strong>sudo apt-get install openjdk-6-jdk</strong><br><im src="slike/predvaja_clip_image003.gif"><br>
5. Prevedemo program <strong>javac bintodec3.java</strong><br>
- 6. Lahko ga še zaženemo ter preizkusimo <strong>java bintodec3</strong>. Na standardni vhod vnasemo IP naslov ali ime streĹľnika NTP streĹľnikm ki nam pošlje 32 bitno število in pretvori v ÄŤas<br><img src="slike/bu9.png"><br></p>
+ 6. Lahko ga še zaženemo ter preizkusimo <strong>java bintodec3</strong>. Na standardni vhod vnasemo IP naslov ali ime streĹľnika NTP streĹľnikm ki nam pošlje 32 bitno število in pretvori v ÄŤas<br><br></p>
<p>PYTHON------<br>
1. Z ukazom nano bintodec3.py ustvarimo in odpremo prazen program s tekstovnim urejevalnikom nano<br>
2. Napišemo program za pretvarjanje 32-bitnega števila v ÄŤas<br>
-<img src="slike/bu5.png"><br>
3. Pritisnemo Ctrl+X, nato Y in Enter, da program zapremo in shranimo.<br>
4. Program zaženemo z ukazom <strong>python bintodec3.py</strong><br><img src="slike/bu8.png"><br></p><br><br>
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) |