implemented getDrift method

This commit is contained in:
fros4943 2008-10-29 08:36:12 +00:00
parent cb790a62e3
commit 2a2be77707
2 changed files with 11 additions and 3 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: MspClock.java,v 1.3 2008/10/28 17:03:37 fros4943 Exp $ * $Id: MspClock.java,v 1.4 2008/10/29 08:36:12 fros4943 Exp $
*/ */
package se.sics.cooja.mspmote.interfaces; package se.sics.cooja.mspmote.interfaces;
@ -42,7 +42,7 @@ import se.sics.cooja.mspmote.MspMote;
import se.sics.mspsim.core.MSP430; import se.sics.mspsim.core.MSP430;
/** /**
* @author Fredrik Osterlind * @author Fredrik Österlind
*/ */
@ClassDescription("Cycle clock") @ClassDescription("Cycle clock")
public class MspClock extends Clock { public class MspClock extends Clock {
@ -69,6 +69,10 @@ public class MspClock extends Clock {
myMote.cycleDrift = MspMote.NR_CYCLES_PER_MSEC * drift; myMote.cycleDrift = MspMote.NR_CYCLES_PER_MSEC * drift;
} }
public int getDrift() {
return myMote.cycleDrift / MspMote.NR_CYCLES_PER_MSEC;
}
public JPanel getInterfaceVisualizer() { public JPanel getInterfaceVisualizer() {
return null; return null;
} }

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ContikiClock.java,v 1.5 2008/10/28 12:55:20 fros4943 Exp $ * $Id: ContikiClock.java,v 1.6 2008/10/29 08:36:40 fros4943 Exp $
*/ */
package se.sics.cooja.contikimote.interfaces; package se.sics.cooja.contikimote.interfaces;
@ -88,6 +88,10 @@ public class ContikiClock extends Clock implements ContikiMoteInterface, PolledB
this.timeDrift = timeDrift; this.timeDrift = timeDrift;
} }
public int getDrift() {
return timeDrift;
}
public int getTime() { public int getTime() {
return moteMem.getIntValueOf("simCurrentTime"); return moteMem.getIntValueOf("simCurrentTime");
} }