Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-10-23
8
Medium Priority
?
198 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 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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: 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 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 video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

730 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