diff options
author | ap9176@student.uni-lj.si <ap9176@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-18 14:23:24 +0000 |
---|---|---|
committer | ap9176@student.uni-lj.si <ap9176@student.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414> | 2014-12-18 14:23:24 +0000 |
commit | 3140a8eac7ca77d1d8b6f99d74f23b054bb53d75 (patch) | |
tree | 190aa00ca40a9259259b3a96d2c5ca24512bdcea /kpov_judge/tasks/custom_rdate | |
parent | 0a4bbfb54d7855ad32465a6474bf5e8f4d49e0ac (diff) |
rdate
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@103 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks/custom_rdate')
-rw-r--r-- | kpov_judge/tasks/custom_rdate/rDate.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/kpov_judge/tasks/custom_rdate/rDate.java b/kpov_judge/tasks/custom_rdate/rDate.java new file mode 100644 index 0000000..8c8bae7 --- /dev/null +++ b/kpov_judge/tasks/custom_rdate/rDate.java @@ -0,0 +1,34 @@ +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStreamWriter; +import java.net.Socket; +import java.net.SocketException; +import java.nio.ByteBuffer; +import java.uti.Date; +import java.util.Scanner; + +public class rDate{ + + public static void main(String[] args) throw IOException{ + Scanner sc=new Scanner(System.in); + String niz=sc.next(); + + try{ + Socket s=new Socket(niz,37); + OutputStreamWriter izhod=new OutputStreamWriter(s.getOutputStream()); + InputStream vhod=s.getInputStream(); + byte[] podatek=new byte[4]; + ByteBuffer buf=ByteBuffer.wrap(podatek); + int stevilka=buf.getInt(); + long dolga=stevilka + long maska=-1; + maska =~(maska <<32); + dolga = dolga & maska; + Date d=new Date(dolga *1000 - 2208988800000L); + System.out.print(d); + izhod.write(d.toString()); + }catch(SocketException e){ + System.out.println("Strežnik ne obstaja"); + } + } +} |