SetTime
by Pete Pinter
Calgary, Alberta, Canada
(Revision History)
SetTime FAQ File
SetTime, and the OpenGL 3D graphics version called SpaceTime, are Simple Network Time Protocol (SNTP) clients
available with complete Visual C++ source code
originally written as programming examples to legibly demonstrate:
Windows Programming in Visual C++ and MFC
WinSock Programming over the Internet
Memory based Device Context (DC) handling
Dynamically resized Fonts and Buttons
Right Mouse Button Menus
Status Bar Handling
Graphic Bitmaps as Menu options
Registry Persistence of Parameters and Options
Basic GDI Graphics Operations
Basic Command Line handling
Basic Multi-Threaded Programming
Taskbar Notification Tray Handling
RFC868 (Time Protocol) Support
RFC2030 (SNTP Protocol) Support
For newbies looking to get into Windows programming with Visual C++,
the learning curve is steep. Not only do you have to wrestle with the new
object oriented syntax and 'paradigm' of C++, but the Windows API as encapsulated
in MFC as well.
Both SetTime and SpaceTime were written as a protest against all the baroque and unreadable
code out there and to hopefully make the process of finding useable code
samples easier for other new programmers. It's most salient benefit is
that it implements a complete program in one, readable, source code file
while being completely MFC compliant. Bypassing the AppWizard and ClassWizard
code generators enables SetTime and SpaceTime to be legible programming examples.
Incidentally, you can use these programs to keep your system clock in
nearly perfect step with the rhythms of the universe while hopefully learning
valuable and marketable skills in a burgeoning area of the computer industry.
It's no exaggeration that object-oriented programmers who can craft Internet
aware applications will continue to be in demand for the forseeable future.
Bottom line: if you decide that Visual C++ is for you, SetTime and its big brother
SpaceTime may help make the learning process a little easier.
If all you're looking for is accurate time, they can help you there as well.
SetTime and SpaceTime Source Code is Available
First, may I respectfully request that *all* users of SetTime or SpaceTime
support my variation of the shareware concept, which I call Beerware.
All I ask is that you send along the price of a pint of Double Diamond ($5.00
U.S., Canadian, Australian, whatever) in the mail to this address,
with my sincere thanks for your support.
As additional thanks for showing there are still honourable men on
the Internet, I'll send you the complete Visual C++ source code and project files to
both SetTime and SpaceTime (the OpenGL 3D Graphics Version)
via an Email attachment.
Once again, if you find SetTime or SpaceTime useful, then please support Beerware!!!
Click these Java applets to download SetTime (37KB) and SpaceTime (500KB) ZIP files
(Java 1.1 compatible browser needed*)
*Still can't see the Applets?
Try this page which will install Sun's 5MB Java 1.1 VM as a Netscape or IE Plug-in.
(Windows and Solaris Only)
In closing, I'd like to thank everyone for their interest in my small
contributions to the wired community. I'm gratified that so many people
throughout the world have used SetTime and SpaceTime as a basis for further study in
VC++, MFC, WinSock and/or OpenGL programming. Between us all, we'll figure this stuff
out...
Cheers Mate!
/P2
P.S. Check out http://www.eecis.udel.edu/~mills/ntp/servers.html
for a current list of NTP Servers, worldwide. It will help keep your use
of SetTime local to your geography, and therefore more reliable. Remember
to use a Stratum 2 (Secondary) timebase whenever possible.
Revision History:
98/09/05:
- SpaceTime Updated: Removed the Win95 OpenGL DLL files from the SpaceTime.zip file as they are huge, and mostly redundant by now as virtually everyone has a current copy of Win95 or
later (Win98 and NT users already have OpenGL support).
- Included in the SpaceTime.zip file is a copy of SpaceTime (Mark II), a prototype of my new version featuring a completely redesigned rendering engine. Smaller,
faster and with vastly improved image quality, this version allows any 3D Studio Max artwork to be decoded and rendered to the screen
with OpenGL. Stay tuned for more enhancements as I continue to learn the finer points of OpenGL programming. Remember, complete
source code to both SetTime and SpaceTime is available to anyone who buys me a beer!
98/03/25:
-
Added colour control to SetTime, to handle the case where a strange desktop colour theme renders my digit display invisible.
98/01/20:
-
Announcing the source code availability of SpaceTime,
the OpenGL 3D Graphics version of SetTime, to all those who buy me a beer.
97/08/04:
-
Added the SetTime Help
Page as an option off the Help Menu to answer some usability questions,
etc.
97/05/20:
-
Added support which demonstrates Taskbar Notification Tray handling, such
that SetTime will now allow you to minimize down to the Taskbar Tray with
Right Mouse Options to either correct the system clock, or exit.
-
Overhauled the SNTP protocol handling to now account for Local Clock Offset,
per RFC2030. This will result in greater accuracy, provided both your CPU
and Internet connections are fast.
97/03/05:
-
While becoming increasingly impatient waiting for Java to grow up as a
production language (but don't get me started), I've added a couple refinements
to that old stalwart, SetTime, in response to some of the E-mail requests
received of late. As such, I've added:
-
Basic Multi-Threaded support to graphically monitor the time taken by timebases
to respond to a query. This has been a job and a half. Sure makes me pine
wistfully for the good old days of RSX and VMS system programming where
Asynchronous System Traps, global event flags, and other obvious constructs
were implemented so elegantly. Especially odd is that NT was architected
by the same high priest of operating systems design: the infamous Dave
Cutler who implemented RSX-11M in 1972 and VMS in 1978.
-
Basic Progress Control Bar (on a Status Bar pane) to display the above
mentioned timebase response delay. As an aside, this means that SetTime
will continue polling a timebase every few seconds until successful, or
until the user explicitly issues the 'Reset' menu option. This may further
help those who put SetTime in their Start-up group to automatically set
the PC clock on system boot. Remember to put some text on the target command
line (ie: /RunOnce_and_Split) to enable this Set and Exit feature.
96/10/01:
-
Added a 'Reset' option to the command menus to allow you to abandon
hope that a Timebase will eventually respond. This is necessary as both
Time/UDP and SNTP protocols use Unreliable Datagram Protocol (UDP) packets
which can, and will, get dropped by Internet routers along the path to
a distant Timebase.
96/05/30:
-
Added a key in the System Registry to remember the last Timebase selected.
The key is: HKEY_CURRENT_USER\ Software\P-Squared\SetTime\Options\TimeBase
and defaults to tick.usno.navy.mil the first time SetTime is run.
-
Added an Alternate Timebase Selection dialog box for those users
for whom the US Naval Observatory in Washington, DC is not the nearest
timebase.
-
Added Basic Command Line Handling. Now, anything on the command line (ie:
/RunOnce) will cause SetTime to attempt to reset the system clock
from the last selected Timebase. Useful if you are always connected to
the Internet and have put SetTime in your STARTUP folder.
-
Added a couple of GDI Graphics Objects to demonstrate basic functionality.
The intention is to possibly adopt a panel display that resembles Michael
Okuda's bridge consoles on Star Trek:The Next Generation, widely known
as Okudagrams.
-
Added a Message Box when SetTime discovers the PC is more than 30 minutes
off from the Timebase clock. This helps catch bogus TZ variables. Safety
tip: if a Timebase consistently reports the wrong time, it's a sign
your TZ variable is set wrong. If you don't need a TZ variable in your
AUTOEXEC.BAT (or Environment Variables under NT), then remove it, and let
Windows (NT or 95) handle Timezones and, especially, Daylight Savings Time
settings.
Here's the pitch:
-
If you believe in upholding the shareware principle
-
or desire the complete Visual C++ source code to SetTime and/or SpaceTime
then how about buying me a beer? Simply put $5.00 in the post to this address:
Pete Pinter
163 Signal Ridge Link, S.W.
Calgary, Alberta, CANADA
T3H 2J9
To the many friends of SetTime and SpaceTime throughout America, please note:
-
Apparently, $0.46 postage is needed for mail to Canada
-
Ordinary chequing account cheques are fine (yup, that's how we spell 'checks'
up here)
-
Alternately, a US$5.00 bill (folded into a sheet of paper) would be especially
appreciated by my bartender
Make sure you include your Email address with your contribution and I'll
reply with the complete SetTime and SpaceTime source code kits as an Email attachment.
Thank you for your support!