Page 1 of 1

need some programmer help

Posted: Sat Jan 16, 2010 12:27 am
by Spinning Hat
I've been looking for the last few days unsuccessfully for a timer/stopwatch chronograph that I can run on my desktop when I run practice ATC problems. There's plenty of different ones out there, but I haven't found any that will allow me to set a custom time, and count up like a real clock would, and still allow me to stop, rewind, etc.

The reason i need this kind of functionality, is when running a control problem, we need to have a clock running so we can plan our traffic flows, etc. and in a non-radar environment, time is our friend. We have one in class that we use, but it is owned/ protected by FAA, and I do not have access to it outside the classroom. Anyone know of any out there like this, or know a good way to put one together using Java?

Posted: Sat Jan 16, 2010 8:03 pm
by XMEN Gambit
Found this after a quick search, sounds like what you're talking about...

http://www.filesland.com/companies/dnSo ... watch.html

Posted: Mon Jan 18, 2010 6:14 pm
by Spinning Hat
I actually downloaded and tried the freeware version which is supposed to be fully functional, but I can not set a time and have it count up, it will only count down. :/ I'll have to keep looking I guess.

Posted: Thu Jan 21, 2010 12:04 am
by BlackRider
So what exactly do you want? Do you want an alarm clock that you can pause?

What format do you want?
* hh:mm:ss? do you need precision beyond that?

What functionality do you need?
* set time (+/- buttons for hours, mins, seconds?)
* start/stop
* alarm (single alarm or multiple alarms?)

Posted: Sat Jan 23, 2010 4:15 pm
by Spinning Hat
I don't need any alarms, just need to be able to set a time, start, stop, and reset. And it just needs to count up like a clock, I don't have any real need for a countdown. And if I can make it full screen, so we can all see the time well, then that'd be perfect.

Posted: Sun Jan 24, 2010 1:05 am
by XMEN Ashaman DTM
Here is a stopwatch in java...


http://wiki.forum.nokia.com/index.php/A ... E#Download

Here is another one that looks more useful:

http://www.cooperjr.name/Java_stopwatch


I just glanced real quick, and it looks like source and .jar files are available for both.

Posted: Sun Jan 24, 2010 3:37 am
by BlackRider
Ok, here's take one: http://www.microsmithinc.com/BlackRider/HatClock.zip
Image
Simple instructions:
* 2 buttons, start/stop & reset.
-- Start/Stop starts & stops the clock
-- Reset resets the time to what's in the DateTimePicker control
* maximize for full screen effect! :shock:

Pardon the colors (assuming they work). I figured green/black would work well full screen. They worked fine on my computer, but on my dad's laptop the background color was white & it looked kind of goofy.

Oh, and this was a 10 min project turned into about 2 hours. I was writing it like I learned to program in the 90's and my brother came in and basically had me rewrite the entire program, making full use of the .NET API. My integers for Hours, Minutes, etc. all went into a DateTime and all the methods that gave me meant that all the code I wrote for formatting the Label string (clock) went right out the door. All I needed now was a simple .ToString("HH:mm:ss.ff") and DONE!

The fun part was scaling the font. I took the ratios of newWidth/origWidth and newHeight/origHeight and multiplied the smallest one against the original font size... but I couldn't directly modify the font size. So my bro. figured out that we could create a new Font instance w/ the new font size and labelClock.Text.Font = newFont and DONE!

So after those two hours my code was 1/4 the length of the original code and twice as functional!

Posted: Sun Jan 24, 2010 1:01 pm
by Spinning Hat
That looks great, and works really good, but I think the time is slow. I had done a completely non scientific comparison between my system clock ticking off seconds, and the java clock Asha posted above, and it was about 1.75 to one. Also, is there a way I can set it for the 24 hour clock? I don't need to use AM PM, since all ATC is done in UTC. If not, no biggie, we can do the conversion to the 24hr clock in real time.

Damn you guys are awesome. :D

Posted: Sun Jan 24, 2010 4:52 pm
by BlackRider
lol, I just realized it is slow............... I think I might know what it is.

*update* Ok, redownload it. I forgot the the Windows Forms Timer isn't accurate enough to use for a clock (not at the milliseconds level anyway). So I simply changed it to a deltaTime = lastTime.Subtract(DateTime.Now) to find a more accurate change in time for timer ticks. I tested it for 45 minutes and it was accurate as far as I could tell.

Posted: Sun Jan 24, 2010 11:26 pm
by Spinning Hat
That's perfect, thanks man!