Re: can make SNTP client to work
- From: "swc" <news.10.swc@xxxxxxxxxxxxxxx>
- Date: Wed, 24 Dec 2008 09:06:26 -0500
Thanks Paul,
You're right, the settings work. I tried the same NK.BIN running at my
home network, it works as you described.
the office must have firewall filtering the device.
anyway on to the next problem.
Is there a way to extract the list of timezone info(time offset and location
name string) from the datetime or somewhere (open source,etc),
so I can build my own timezone, dst selector/picker?
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:OE2Tf3UYJHA.556@xxxxxxxxxxxxxxxxxxxxxxx
I just tried your settings with my test program and they update the clock
no problem (I don't set the ServerRole registry entry, however). I set my
clock to 1:50pm (actual time 1:12pm), did a "Set", and the clock was
immediately updated to 1:12pm.
Paul T.
"swc" <news.10.swc@xxxxxxxxxxxxxxx> wrote in message
news:eli377TYJHA.684@xxxxxxxxxxxxxxxxxxxxxxx
I looked at the source and fixed the values for the registry settings.
Now I can get the handle to the NTP0: and query/control the service, it
all return ok
on the DeviceIoControl, BUT the clock doesn't update. it does not auto
update either.
I tried the Sync and Set control, DeviceIoControl return ok, but not the
clock doesn't change.
and I again tested using time differences of minutes, and hours
[HKEY_LOCAL_MACHINE\Services\TIMESVC]
"server"=multi_sz:"tock.usno.navy.mil","time.windows.com"
"AutoUpdate"=dword:1
"ServerRole"=dword:0 ; Client mode
"refresh"=dword:493E0 ;5 min ;5265C00 ; daily
"recoveryrefresh"=dword:493E0 ;every 5 minute 36EE80 ; hourly
"threshold"=dword:5265C00 ; 1 day
"trustlocalclock"=dword:0 ; wait for synch.
WCHAR szDevName[] = TEXT("NTP0:");
//HANDLE hService = CreateFile(L"NTP0:",0,0,NULL,OPEN_EXISTING,0,NULL);
HANDLE hService =
CreateFile(szDevName,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
if(hService != INVALID_HANDLE_VALUE)
{
DWORD err;
DWORD dwState; //state values are defined in service.h
if(!DeviceIoControl(hService, IOCTL_SERVICE_STOP, NULL, 0, NULL, 0,
NULL, NULL))
{
err = GetLastError();
if(err == 1062)
_tprintf(TEXT("The service has not been started.err=%d\n"),err);
}
if(!DeviceIoControl(hService, IOCTL_SERVICE_START, NULL, 0, NULL, 0,
NULL, NULL))
{
err = GetLastError();
_tprintf(TEXT("Start err=%d.\n"),err);
}
if (DeviceIoControl(hService, IOCTL_SERVICE_STATUS, NULL, 0, &dwState,
sizeof(DWORD), NULL, NULL))
{
if (dwState==1)
{
if (DeviceIoControl(hService, IOCTL_SERVICE_REFRESH, NULL, 0, NULL,0,
NULL, NULL))
printf(("Service refresh successful\r\n"));
else
printf(("Service refresh failed!\r\n"));
// WCHAR szControlString[]=L"Sync";
WCHAR szControlString[]=L"set";
DWORD dwLenIn=sizeof(szControlString);
DWORD dwBytesReturned;
if (DeviceIoControl(hService, IOCTL_SERVICE_CONTROL, szControlString,
dwLenIn, NULL, 0, &dwBytesReturned, NULL))
printf(("Service sync successful\r\n"));
else
printf(("Service sync failed\r\n"));
}
}
CloseHandle(hService);
}
printf(("done\r\n"));
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:e0mxMpvXJHA.1324@xxxxxxxxxxxxxxxxxxxxxxx
There's a program, services.exe, that you can run to query the status of
various services. I can't possibly tell what else might be wrong
without a lot more information. Did you build the service into your OS?
What device name are you trying to open? I can't read all of your code
or your mind, so you'll have to think about what I can learn from what
you've posted.
You'll have to tell the service, of course, when you change the registry
settings, if you do that at run-time, rather than in the nk.bin image of
the OS itself.
Assuming you installed the shared source, the server is found at:
\WINCE500\PRIVATE\SERVERS\TIMESVC2
Nothing that you install in PRIVATE has anything to do with any normal
build.
There's some other general advice in this newsgroup post:
http://groups.google.com/group/microsoft.public.windowsce.app.development/browse_thread/thread/cebe4d5103e2c20b?hl=en&q=time+service+refresh+group:microsoft.public.windowsce.*
Paul T.
"swc" <news.10.swc@xxxxxxxxxxxxxxx> wrote in message
news:O7HXhOvXJHA.760@xxxxxxxxxxxxxxxxxxxxxxx
Well, changing the refresh to 5 min didn't work either.
so I tried to see what the status of the sntp service are and am
suprised that the CreateFile() function failed.
with a GetLastError() returns 55, device not exists.
Am I still missing a step somewhere? did the service got unload/or
something that make it not exist?
Where is the source code? I couldn't find it.
I might not have install it, and if so, I am afraid to install it at
this point and corrupts my build env.(I can't afford to to this now,
I don't need this functionality until a few more months.
#define ERROR_DEV_NOT_EXIST 55L // dderror
HANDLE hService =
CreateFile(szDevName,GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:OOwMPatXJHA.1328@xxxxxxxxxxxxxxxxxxxxxxx
The minimum Refresh value is 5 minutes, 5*60*1000. Read the code of
the server to see other limitations on what values in the registry are
valid...
Paul T.
"swc" <news.10.swc@xxxxxxxxxxxxxxx> wrote in message
news:%23jI3MBJXJHA.4168@xxxxxxxxxxxxxxxxxxxxxxx
I have read all the posts and did what it said, but still does not
work.
I have been trying to make this work for a long time and it still
fails.(time did not sync)
I am using WinCE 5.0
I am the SNTP Automatic Updates and Server Implementation, SNTP
Client with DST added to my build.
I have the following registry in the project.reg and it does show up
in reginit.ini (and also check using the remote registery editor)
after a makeimg
[HKEY_LOCAL_MACHINE\Services\TIMESVC]
"server"=multi_sz:"0.pool.ntp.org","tock.usno.navy.mil","time.windows.com"
; I have also try not overriding this as the module includes, but
still does not work
"AutoUpdate"=dword:1
"ServerRole"=dword:0 ; Client mode
"refresh"=dword:7530 ;30sec ;5265C00 ; daily
"recoveryrefresh"=dword:36EE80 ; hourly
"threshold"=dword:5265C00 ; 1 day
"trustlocalclock"=dword:0 ; wait for synch.
If I did this correctly, it is supposely to update/sync every
30sec(just so I can test it).
after CE boots,
I waited more than a minute and also open the clock control to ensure
it is refreshed.
but I do not see the time get sync'ed.
I tried changing the clock manually to be off by a few hours, a few
hours, days, years. none works.
.
- Follow-Ups:
- Re: can make SNTP client to work
- From: Paul G. Tobey [eMVP]
- Re: can make SNTP client to work
- References:
- can make SNTP client to work
- From: swc
- Re: can make SNTP client to work
- From: Paul G. Tobey [eMVP]
- Re: can make SNTP client to work
- From: swc
- Re: can make SNTP client to work
- From: Paul G. Tobey [eMVP]
- Re: can make SNTP client to work
- From: swc
- Re: can make SNTP client to work
- From: Paul G. Tobey [eMVP]
- can make SNTP client to work
- Prev by Date: Re: Can pxa255/pxa270 support mobile SDRAM?
- Next by Date: Re: RasDial function
- Previous by thread: Re: can make SNTP client to work
- Next by thread: Re: can make SNTP client to work
- Index(es):
Relevant Pages
|