This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

adamkjelstroem
adamkjelstroem presents ...

2012/8/9

Clock

My clock emulator!
Notice that the Clock is set to time zone UTC+1 and summer time. I will release an update fixing the problem.

3441 views / 15 in the last 7 days

Tags: clock time seconds minutes days months chronometer hours years now

Your browser does not support the canvas tag.
Busch2207Busch2207

2012/8/9

You have reversed the large and the small hand.
A new version of this scenario was uploaded on Thu Aug 09 12:16:35 UTC 2012
SPowerSPower

2012/8/9

About the wrong timezone, when you use System.getCurrentTimeMillis, you won't have that problem.
That is not right. i'm on a vacation now in a time zone -6 of my own. the clock emulator says it is 6 hours in front of the actual time. The solution involves something about making a 'new Date()' but i don't know how that works. if you know a good introduction video or something like that, please let me know.
MatheMagicianMatheMagician

2012/9/13

If you use Calendar() (which has very similar code to Date()), you will not have a problem. I use Calendar in my tank game and it works perfectly as far as I can tell. All you need to use it is import java.util.Calendar; and the create a new date object: Calendar today = Calendar.getInstance(); and then you can access something, like what hour it is this way: int hour = today.get(Calendar.HOUR);
danpostdanpost

2012/9/13

You could always let the user choose between the 24 time zones, and adjust on choice. Doing that will always make it right. You could also add a button to switch Daylight Savings on and off; but, restrict it to only those time zones that use it.
danpostdanpost

2012/9/13

Another thing: the hour hand stays on the exact number until the next hour arrises. It should pan across from number to number. When it gets close to the next hour, it 'appears' (just looks like) that the time is off an hour.
danpostdanpost

2012/9/13

To fix the hour hand, just add a degree to its rotation every 2 minutes (instead of 30 degrees every hour).

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.