Thread: Events/Tasks Getting time till reexecute

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Events/Tasks Getting time till reexecute 
    Donator

    Join Date
    Jun 2010
    Posts
    670
    Thanks given
    89
    Thanks received
    26
    Rep Power
    54
    Hello guys,

    Can I somehow get the time till a event is executing again?

    Let's say I start a new task:

    Code:
    TaskQueue.queue(new Task(3600)

    The Task will reexecute in 3600 milli seconds I think, but how can I get the time till reexecute?


    All regards, MarkQ
    Reply With Quote  
     

  2. #2  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    3600 again if its not been stopped
    Reply With Quote  
     

  3. #3  
    Donator

    Join Date
    Jun 2010
    Posts
    670
    Thanks given
    89
    Thanks received
    26
    Rep Power
    54
    Quote Originally Posted by Stuart View Post
    3600 again if its not been stopped
    I think you don't understand what I want, I want to get a method like getTaskTime to see how many milli seconds still it executes again.
    Reply With Quote  
     

  4. #4  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Quote Originally Posted by MarkQ View Post
    I think you don't understand what I want, I want to get a method like getTaskTime to see how many milli seconds still it executes again.
    well you'll need a timestamp of when it was last ran and then compare now to then
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    Jun 2010
    Posts
    670
    Thanks given
    89
    Thanks received
    26
    Rep Power
    54
    Then show me how to do that? I actually haven't done anything with time stamps.
    Reply With Quote  
     

  6. #6  
    Respected Member


    Join Date
    Jul 2015
    Posts
    781
    Thanks given
    206
    Thanks received
    394
    Rep Power
    524
    Quote Originally Posted by MarkQ View Post
    Then show me how to do that? I actually haven't done anything with time stamps.
    when task is ran, save current time to variable. then create a method that returns that variable. compare current time and that methods return value. thats how much time has passed!

    thats the logic you need, there are methods that you can implement that will do it for you.
    Reply With Quote  
     

  7. Thankful user:


  8. #7  
    Donator

    Join Date
    Jun 2010
    Posts
    670
    Thanks given
    89
    Thanks received
    26
    Rep Power
    54
    Quote Originally Posted by RileyM View Post
    when task is ran, save current time to variable. then create a method that returns that variable. compare current time and that methods return value. thats how much time has passed!

    thats the logic you need, there are methods that you can implement that will do it for you.
    Ok and what methods will do that for me? xD
    Reply With Quote  
     

  9. #8  
    Banned
    Join Date
    Jan 2011
    Posts
    334
    Thanks given
    20
    Thanks received
    88
    Rep Power
    0
    Quote Originally Posted by MarkQ View Post
    Ok and what methods will do that for me? xD
    And you have a service thread?

    All you need is System.currentTimeMillis()
    Reply With Quote  
     

  10. #9  
    Donator

    Join Date
    Jun 2010
    Posts
    670
    Thanks given
    89
    Thanks received
    26
    Rep Power
    54
    Quote Originally Posted by Wrecked... View Post
    And you have a service thread?

    All you need is System.currentTimeMillis()
    Um I'm not quite sure how that works lol

    let's say i got this task running:

    Code:
    public static void runTimeTask(){
                int nextExecute = 3600;
            TaskQueue.queue(new Task(nextExecute){
                         
    			@Override
    			public void execute() {
                                          //DOING TASK HERE          	                      
    			}
    
    			@Override
    			public void onStop() {
                               
    			}
    		});
            }
    I want a method that checks the time till next execute;

    Code:
    private void getTimeTillNextExecute()
    But I rly don't know how to do that again xD it's the help section not the "hint" section. Please help me.
    Reply With Quote  
     

  11. #10  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Paste your Task class. How you determine the time until the next execute is going to be based on how you decrement the value passed in the constructor. Im unable to help without this basic information.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Converting tele timer in process to event/task
    By Our Promise in forum Snippets
    Replies: 2
    Last Post: 07-25-2014, 01:31 AM
  2. Replies: 17
    Last Post: 01-17-2013, 06:07 AM
  3. Random events have perfect timing
    By Fakku in forum Media
    Replies: 5
    Last Post: 12-28-2011, 03:23 AM
  4. Replies: 13
    Last Post: 07-19-2010, 11:32 PM
  5. How to change time till force log out?
    By daone11 in forum Help
    Replies: 0
    Last Post: 08-20-2009, 07:58 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •