Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need a clock that is not dependent upon Window's clock...

Posted on 2003-10-23
8
Medium Priority
?
199 Views
Last Modified: 2013-11-20
How can I make sure that the user will not be able to change the clock?  I am making a program that needs to keep track of payment times/dates, and if the user changes the date via system tray icon, they screw up my program.

Thanks!
0
Comment
Question by:alexswinney
  • 3
5 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9608523
You can control the clock during runtime.
But it'll not solve the other problem - user can stop you program, change time and then start you program.
0
 
LVL 6

Expert Comment

by:GloomyFriar
ID: 9608549
I mean you can read the current time when you program is started.
And than check time for example every second with usage of GetTickCount.
If time is changed - change it back ;-)
0
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 100 total points
ID: 9608602
If your programm operate under Win NT/2000/XP/... you can make a service to control time.
The user should not have the rights to start or to stop the service.
Under win 95/98/ME it can be hidden process.
0
 
LVL 13

Assisted Solution

by:SteH
SteH earned 100 total points
ID: 9613053
I can think of 2 possiblities:
1) connect to a time server on the net (if it is available) or check windows time with it.

2) There a radio controlled clocks or getting time from a satellite. (Every GPS receiver sends the time as well). In germany there is the DCF77 signal but there are others around the world.
http://www.heret.de/funkuhr/ausland.htm (in german but around the world)
http://www.bldrdoc.gov/timefreq/index.html (for the US)

These clocks exist as usb/serial or parallel devices.You just need one with a driver for C++.
0
 
LVL 4

Expert Comment

by:r2far
ID: 9617282
Get the time when the progrram starts, and have the program maintain it's own time after it starts.  The only problem is that, like 'GloomyFriar' stated, what is preventing the user from closing the app, changing the time, and restarting it.

Another option is to when the program shuts down, store the current time, and the systems tick count in a file.  When the program starts, load the ticks and time then get the current ticks and calculate what time it should be, then compare to actual time.  Then you would have to worry about how to handle when the computer restarted, or if the program is shut down for more than 49.7 days while the machine is continously running (in which case the tick count will overlap).
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question