summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/custom_rdate/rDate.java
blob: 8c8bae709216139a26c3ae0161c8be402715c904 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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");
		}
	}
}