Solved

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

Posted on 2003-10-23
8
191 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
8 Comments
 
LVL 6

Expert Comment

by:GloomyFriar
Comment Utility
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
Comment Utility
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 25 total points
Comment Utility
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 25 total points
Comment Utility
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
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
configuration management 2 99
Include multiple hostnames in this command? 3 51
matchUp  challenge 6 48
sumHeights2  challenge 7 75
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now