need some programmer help

Wanna understand E=mc2, English grammer, or maybe just build a computer? We can help!

Moderator: Moderators

Post Reply
User avatar
Spinning Hat
Inmate
Posts: 2564
Joined: Wed Jun 07, 2000 10:06 am
Location: Minneapolis, MN
Contact:

need some programmer help

Post 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?
Image
"Never, Never, Never quit." - Winston Churchill
"Men don't like to cuddle. They only cuddle if it leads to.. You know.. Lower cuddling." - Ray Romano
"Tell your wife that she looks pretty, even if she looks like a dump truck." - Ricky, age 10
User avatar
XMEN Gambit
Site Admin
Posts: 4122
Joined: Thu Nov 18, 1999 12:00 am

Post by XMEN Gambit »

Found this after a quick search, sounds like what you're talking about...

http://www.filesland.com/companies/dnSo ... watch.html
Image
User avatar
Spinning Hat
Inmate
Posts: 2564
Joined: Wed Jun 07, 2000 10:06 am
Location: Minneapolis, MN
Contact:

Post 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.
Image
"Never, Never, Never quit." - Winston Churchill
"Men don't like to cuddle. They only cuddle if it leads to.. You know.. Lower cuddling." - Ray Romano
"Tell your wife that she looks pretty, even if she looks like a dump truck." - Ricky, age 10
BlackRider
Inmate
Posts: 966
Joined: Thu Jan 17, 2002 5:26 pm

Post 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?)
User avatar
Spinning Hat
Inmate
Posts: 2564
Joined: Wed Jun 07, 2000 10:06 am
Location: Minneapolis, MN
Contact:

Post 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.
Image
"Never, Never, Never quit." - Winston Churchill
"Men don't like to cuddle. They only cuddle if it leads to.. You know.. Lower cuddling." - Ray Romano
"Tell your wife that she looks pretty, even if she looks like a dump truck." - Ricky, age 10
XMEN Ashaman DTM
Inmate
Posts: 2369
Joined: Mon Oct 02, 2000 12:09 am
Location: Silverdale, WA

Post 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.
BlackRider
Inmate
Posts: 966
Joined: Thu Jan 17, 2002 5:26 pm

Post 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!
User avatar
Spinning Hat
Inmate
Posts: 2564
Joined: Wed Jun 07, 2000 10:06 am
Location: Minneapolis, MN
Contact:

Post 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
Image
"Never, Never, Never quit." - Winston Churchill
"Men don't like to cuddle. They only cuddle if it leads to.. You know.. Lower cuddling." - Ray Romano
"Tell your wife that she looks pretty, even if she looks like a dump truck." - Ricky, age 10
BlackRider
Inmate
Posts: 966
Joined: Thu Jan 17, 2002 5:26 pm

Post 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.
User avatar
Spinning Hat
Inmate
Posts: 2564
Joined: Wed Jun 07, 2000 10:06 am
Location: Minneapolis, MN
Contact:

Post by Spinning Hat »

That's perfect, thanks man!
Image
"Never, Never, Never quit." - Winston Churchill
"Men don't like to cuddle. They only cuddle if it leads to.. You know.. Lower cuddling." - Ray Romano
"Tell your wife that she looks pretty, even if she looks like a dump truck." - Ricky, age 10
Post Reply