Solved

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

Posted on 2003-10-23
8
192 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
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 25 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 25 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 53
how do i create updater to My Activex application? 3 79
Prevent this page from creating additional dialogs. 3 410
centeredAverage challenge 8 132
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 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

21 Experts available now in Live!

Get 1:1 Help Now