GetTime.js


/*=====================================================================

1. This program calls a script function of service [S2S Time Sync] to get the internet time.
2. This program is for CScript/WScript.  

=====================================================================
var svc=new ActiveXObject("{BA590564-3ADF-446A-94ED-393E52B5A671}"); //use service's AppID
if(!svc)
{
	//If installed but not run, the first line would have started the service
	WScript.Echo("Service [S2S Time Sync] not installed."); 
}
else
{
	var args=svc.CreateFunctionArguments();
	args.Add(1500);
	var r=svc.CallFunction("GetNetTime.js", "GetTime", args);
	if(r)
	{
		WScript.Echo(r.Format());
	}
	else
	{
		WScript.Echo("Could not get time from Service [S2S Time Sync] within 1.5 seconds.\n");
	}
}