-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d742da7
commit e8c689f
Showing
7 changed files
with
59 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/Functions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.firstinspires.ftc.teamcode.utils; | ||
|
||
public final class Functions { | ||
public static double getCurrentTimeMills(){ | ||
return System.nanoTime()/ 1.0E06; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/Mathematics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/Timer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.firstinspires.ftc.teamcode.utils; | ||
|
||
public class Timer { | ||
public double StartTime,EndTime; | ||
public Timer(){ | ||
StartTime=Functions.getCurrentTimeMills(); | ||
} | ||
/**重新定义<code>StartTime</code>*/ | ||
public final void restart(){ | ||
StartTime=Functions.getCurrentTimeMills(); | ||
} | ||
/**定义<code>EndTime</code>*/ | ||
public final void stop(){ | ||
EndTime=Functions.getCurrentTimeMills(); | ||
} | ||
/**获取<code>EndTime-StartTime</code>*/ | ||
public final double getDeltaTime(){ | ||
return EndTime-StartTime; | ||
} | ||
/**定义<code>EndTime</code>并获取<code>EndTime-StartTime</code>*/ | ||
public final double stopAndGetDeltaTime(){ | ||
stop(); | ||
return getDeltaTime(); | ||
} | ||
/**定义<code>EndTime</code>并获取<code>EndTime-StartTime</code>并重新定义<code>StartTime</code>*/ | ||
public final double restartAndGetDeltaTime(){ | ||
double res=stopAndGetDeltaTime(); | ||
restart(); | ||
return res; | ||
} | ||
} |