|
Hi Scott,
"Scott" <smakos499@excite.com> writes:
>
> I am using legjos and...
>
> having problems understanding the clock/timers.
>
> 1. Are their only one timer clock?
yes. It is like a big wall clock that shows milliseconds.
> 2. How do you acess the timers clock? What code would I use?
System.currentTimeMillis();
Note that this is a long integer.
If you need more than one timer you can remember the time in variables
and then compute the difference, like for example
long t0;
long t1;
t0 = System.currentTimeMillis();
for( int i=0; i<10000; i++){};
t1 = System.currentTimeMillis();
LCD.showProgramNumber( 1);
LCD.showNumber( (int)t1-(int)t0);
Button.RUN.waitForPressAndRelease();
This is from examples/performance_test/PerformanceTest.java,
you can use more variables if you need more timers.
There is also the builtin minute timer, but that doesn't seem
terribly useful to me.
Jürgen
--
Jürgen Stuber <stuber@loria.fr>
http://www.loria.fr/~stuber/
|
|
Message is in Reply To:
| | Help with Clock
|
| I am using legjos and... having problems understanding the clock/timers. 1. Are their only one timer clock? 2. How do you acess the timers clock? What code would I use? Scott (22 years ago, 29-Aug-02, to lugnet.robotics.rcx.java)
|
6 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|