/*
* PROJECT: ReactOS Timedate Control Panel
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: lib/cpl/timedate/ntpclient.c
+ * FILE: dll/cpl/timedate/ntpclient.c
* PURPOSE: Queries the NTP server
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
*
*/
-#include <timedate.h>
+#include "timedate.h"
+
+#include <winsock2.h>
#define TIMEOUT 4000 /* 4 second timeout */
if (pInfo->Sock == INVALID_SOCKET)
return FALSE;
- /* setup server info */
+ /* Setup server info */
he = gethostbyname(lpAddress);
if (he != NULL)
{
- /* setup server socket info */
+ /* Setup server socket info */
ZeroMemory(&pInfo->ntpAddr, sizeof(SOCKADDR_IN));
- pInfo->ntpAddr.sin_family = AF_INET; //he->h_addrtype;
+ pInfo->ntpAddr.sin_family = AF_INET; // he->h_addrtype;
pInfo->ntpAddr.sin_port = htons(NTPPORT);
pInfo->ntpAddr.sin_addr = *((struct in_addr *)he->h_addr);
}
}
-/* send some data to wake the server up */
+/* Send some data to wake the server up */
static BOOL
SendData(PINFO pInfo)
{
static ULONG
-RecieveData(PINFO pInfo)
+ReceiveData(PINFO pInfo)
{
TIMEVAL timeVal;
FD_SET readFDS;
INT Ret;
ULONG ulTime = 0;
- /* monitor socket for incomming connections */
+ /* Monitor socket for incomming connections */
FD_ZERO(&readFDS);
FD_SET(pInfo->Sock, &readFDS);
- /* set timeout values */
+ /* Set timeout values */
timeVal.tv_sec = TIMEOUT / 1000;
timeVal.tv_usec = TIMEOUT % 1000;
- /* check for data on the socket for TIMEOUT millisecs*/
+ /* Check for data on the socket for TIMEOUT millisecs */
Ret = select(0, &readFDS, NULL, NULL, &timeVal);
if ((Ret != SOCKET_ERROR) && (Ret != 0))
{
if (SendData(pInfo))
{
- ulTime = RecieveData(pInfo);
+ ulTime = ReceiveData(pInfo);
}
}