Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / February 2004

Tip: Looking for answers? Try searching our database.

Alpha and current time?

Thread view: 
Michael Maier - 09 Feb 2004 18:53 GMT
Is there an easy way to get the current time (milliseconds from the
starting)? Because i would like to set the Alpha object active "Now" but
i don't know the current time and alpha object takes the start time as a
time from starting the application.

For now i'm pausing the object, using the getPauseTime (or something
like that) method to get the pause time (when it was paused) and  resume
the alpha, not very elegant way to do it.

Miichael
JK - 10 Feb 2004 12:47 GMT
Sorry, but I don't get what you are doing with getPauseTime(), because
the result is also relative to startTime.

To get it clear, an Alpha's startTime is the wall clock time all other
times in the alpha object are relative to (e.g. triggerTime). By default
it is the (absolute) start time of the application.

You can get the current (absolute) time with the static
    System.currrentTimeMillis()
method. So you use
    alpha.setStartTime(System.currrentTimeMillis());
to start an alpha object immediately, i.e. as soon as this line of code
is executed. To start it in 2 seconds you can do either
    alpha.setStartTime(System.currrentTimeMillis()+2000);
or
    alpha.setStartTime(System.currrentTimeMillis());
    alpha.setTriggerTime(2000);
If you still need the milliseconds since the start of the app
    long t=System.currentTimeMillis()-alpha.getStartTime();
does the job.

Hope this answers your question.
JK.

> Is there an easy way to get the current time (milliseconds from the
> starting)? Because i would like to set the Alpha object active "Now" but
[quoted text clipped - 6 lines]
>
> Miichael
Michael Maier - 10 Feb 2004 14:35 GMT
 > Hope this answers your question.
> JK.

Yes it did, thank you very much :)

Michael


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.