Re: NTP/NetRemoteTOD And a zone of time



http://www.codeproject.com/KB/winsdk/WorldTime.aspx

Many thanks for the answer! In this case as function
SystemTimeToTzSpecificLocalTime is used :
void WndFunc::GetZoneTime(long lBias, char* pszTime)
{
tzInfo.Bias = lBias;
GetSystemTime(&timeGMT);
SystemTimeToTzSpecificLocalTime(&tzInfo, &timeGMT, &timeOther);
}

But thus lBias it is not calculated, and it is set manually. If transition
to summertime (Daylight Savings Time) lBias difficultly used to determine
independently.

In case NetRemoteTOD it is possible to receive bias through tod_timezone and
using SystemTimeToTzSpecificLocalTime it is possible to receive time of a
server, instead of in the current time zone.

LPTIME_OF_DAY_INFO pBuf = NULL;
NET_API_STATUS nStatus;
wchar_t ServerName[100];
TIME_ZONE_INFORMATION TimeZone;
SYSTEMTIME UniversalTime;
SYSTEMTIME LocalTime;

mbstowcs_dos(ServerName,names_server[i],strlen(names_server[i])+1);
nStatus = NetRemoteTOD(ServerName,(LPBYTE *)&pBuf);
if ( nStatus != NERR_Success || pBuf == NULL ) {
type_off_line_wintime=1;
continue;
}
ZeroMemory(&TimeZone, sizeof(TIME_ZONE_INFORMATION));
ZeroMemory(&UniversalTime, sizeof(SYSTEMTIME));
ZeroMemory(&LocalTime, sizeof(SYSTEMTIME));
if ( pBuf->tod_timezone==-1 ) {
type_off_line_wintime=2;
continue;
}
TimeZone.Bias=pBuf->tod_timezone;
UniversalTime.wSecond=pBuf->tod_secs;
UniversalTime.wMinute=pBuf->tod_mins;
UniversalTime.wHour=pBuf->tod_hours;
UniversalTime.wDay=pBuf->tod_day;
UniversalTime.wMonth=pBuf->tod_month;
UniversalTime.wYear=pBuf->tod_year;
UniversalTime.wDayOfWeek=pBuf->tod_weekday;

rc=SystemTimeToTzSpecificLocalTime(&TimeZone,&UniversalTime,&LocalTime);

Thus it is necessary that the computer on which is synchronized time was in
the domain, that it is not always possible.

For me it is not clear as use NTP it is possible to get bias servers NTP
(time zone server)???
.