package sfs3.extensions.examples.shooter.handlers;

import com.smartfoxserver.bitswarm.data.TransportType;
import com.smartfoxserver.entities.User;
import com.smartfoxserver.entities.data.ISFSObject;
import com.smartfoxserver.entities.data.SFSObject;
import com.smartfoxserver.extensions.BaseClientRequestHandler;

import java.util.Date;

//This request is used to send the server time to clients
public class GetTimeHandler extends BaseClientRequestHandler
{
	@Override
	public void handleClientRequest(User u, ISFSObject data,  TransportType txType) 
	{
	    SFSObject sfsObj = new SFSObject();
	    Date date = new Date();
	    sfsObj.putLong("t", date.getTime());
	    send("time", (ISFSObject)sfsObj, u);
	}
}
