Timing things, am I doing this right?

I have an object that gets created when the space bar gets pressed. I want it to automatically go away (detachChild()) after a set time interval. Right now, I use x = Timer.getTime() to get the start time, then in simpleUpdate() I check to see if Timer.getTime() > x + [some length of time].



It works, but Im finding that there is often a better way built into jMonkey. Ive checked in the javadocs and forum, and theres suprisingly little on this topic.

simple update has tpf, tpf is time per frame, therefore every time simpleupdate is called time increases by a float, if you check your start time of say 0 against tpf for desired length:



updateTime(float tpf){

time = time +tpf;

if(time >5 ){

do something

}}