comparison dwtx/dwtxhelper/TimerTask.d @ 185:987b95661bb9

Added impl for Timer/TimerTask
author Frank Benoit <benoit@tionex.de>
date Sat, 18 Oct 2008 15:02:49 +0200
parents de96284b35d8
children
comparison
equal deleted inserted replaced
184:26589d623405 185:987b95661bb9
4 import dwt.dwthelper.utils; 4 import dwt.dwthelper.utils;
5 import dwt.dwthelper.Runnable; 5 import dwt.dwthelper.Runnable;
6 import dwtx.dwtxhelper.Timer; 6 import dwtx.dwtxhelper.Timer;
7 7
8 class TimerTask : Runnable { 8 class TimerTask : Runnable {
9 package TimeSpan period; 9
10 package Time executionTime; 10 package long scheduled;
11 package Timer timer; 11 package long lastExecutionTime;
12 package long period;
13 package bool fixed;
14
15 this(){
16 this.scheduled = 0;
17 this.lastExecutionTime = -1;
18 }
12 19
13 bool cancel(){ 20 bool cancel(){
14 implMissing( __FILE__, __LINE__ ); 21 bool prevented_execution = (this.scheduled >= 0);
15 return false; 22 this.scheduled = -1;
23 return prevented_execution;
16 } 24 }
17 25
18 abstract void run(); 26 abstract void run();
19 27
20 long scheduledExcecutionTime(){ 28 long scheduledExcecutionTime(){
21 return ( executionTime - Time.epoch1970 ).millis; 29 return lastExecutionTime;
22 } 30 }
23 } 31 }
24 32
25 33