Re: NTP/NetRemoteTOD And a zone of time
- From: "Volodymyr M. Shcherbyna" <v_scherbina@xxxxxxxxxxxxxxx>
- Date: Tue, 13 May 2008 16:47:55 +0200
I am not sure I understand the whole post correctly. Probably you can give a
try, and explain what do you mean in Russian. I will try to comment what I
understood (read inline),
[...]
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.
Correct. It is set manually just to obtain (UTC + 1) or more generally (UTC
+ N). And yes, you have to check if machine is on summer time and adjust
bias correspondly (since the summer time is just a shift in one hour, you
will have to add -60 to bias).
[...]
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);
Yes, this is correct.
[...]
For me it is not clear as use NTP it is possible to get bias servers NTP
(time zone server)???
Here comes misunderstanding. What do you mean?
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
.
- Follow-Ups:
- Re: NTP/NetRemoteTOD And a zone of time
- From: MagicWolf
- Re: NTP/NetRemoteTOD And a zone of time
- References:
- NTP/NetRemoteTOD And a zone of time
- From: MagicWolf
- Re: NTP/NetRemoteTOD And a zone of time
- From: Volodymyr M. Shcherbyna
- Re: NTP/NetRemoteTOD And a zone of time
- From: MagicWolf
- NTP/NetRemoteTOD And a zone of time
- Prev by Date: RE: emulation of gethostbyaddr to resolve to NetBIOS name
- Next by Date: Re: select() always blocks non-blocking socket
- Previous by thread: Re: NTP/NetRemoteTOD And a zone of time
- Next by thread: Re: NTP/NetRemoteTOD And a zone of time
- Index(es):