Solved

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

Posted on 2003-10-23
8
196 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Named range not carried over 10 71
sameEnds challenge 3 196
maven archtype selection in eclipse 1 59
building a service to accessed via telnet client, want colors ? 4 109
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…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.

751 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