package squishgame;
/*
* The stop watch class will allow a program to start and stop a stopwatch as
* well as return the stopwatch as a string, a total ms's, or the hour, min, and
* seconds separately.
*
* The System.currentTimeMillis() returns the number of milliseconds since
*/
public class Stopwatch {
private long myStarttime; // in milliseconds
private long myStoptime;
private boolean isTiming;
public Stopwatch() {
myStarttime = 0;
myStoptime = 0;
isTiming = false;
}
public void Start() {
// starts the clock by getting system time
myStarttime = System.currentTimeMillis();
isTiming = true;
}
public void Stop() {
// stops the clock by getting the system time
if (isTiming) {
myStoptime = System.currentTimeMillis();
isTiming = false;
}
}
public int getHour(){
// returns the hours of the current time (if not timing)
}
public int getMinutes(){
// returns the minutes of the current time (if not timing)
}
public int getSeconds(){
// returns the seconds of the current time (if not timing)
}
public int getMillis(){
// returns the millis of the current time (if not timing)
}
public String toString() {
// returns a string of the time in hours:minutes:seconds.millis
}
}
dahliababy 0 Newbie Poster
kvprajapati 1,826 Posting Genius Team Colleague
dahliababy 0 Newbie Poster
kdkanishka 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.