Time Server Synchronization
This code sample is named CMTime. It demonstrates how to use Connection Manager to establish a connection to a Time Server, and synchronize the Windows Mobile device's internal clock.
Navigate to the solution file (*.sln), and double-click it. By default, the solution file is copied to the following folder:
C:\Program Files\Windows Mobile 6.5.3 DTK\Samples\Smartphone\cpp\Win32\CMTime
Microsoft Visual Studio launches and loads the solution.
Build the solution (Ctrl+Shift+B).
Deploy the solution (F5).
The sample consists of two solutions
This is the Windows Mobile Standard application.
This is a Win32 console application that mimics a Time Server for use with the CMTime device sample. When you run TimeServer.exe the command window will indicate activity when an application connects to get the time.
If you want to use this code sample to connect to a Time Server on the Internet, you can set the IP address for that server in g_in_addr. You can substitute the IP address of any Time Server that supports Time Protocol (RFC-868).
Using a Time Server on the Internet requires that your computer be able to access port 37. Depending on your network and proxy server configuration, you may need to ask your network administrator or help desk what you need to do to access traffic on port 37. Generally, this will require you to install or configure a proxy client on your desktop computer. If your network is not allowing port 37 traffic through to your computer, you will see the message "...Finding Connection..." in the CMTime application window, for about one minute followed by the message "Error getting time!"
For more information on Time Servers, see How to Configure an Authoritative Time Server in Windows Server 2003 on MSDN.