int second = 0;
New Handler (); New Runnable () { @Override publicvoid run () { second+ +; Patrol_time_txt.settext (Util.gettime (second)); ); } };
///seconds converted to minutes 00:00:00
Public StaticString GetTime (intsecond) { if(Second < 10) { return"00:0" +second; } if(Second < 60) { return"00:" +second; } if(Second < 3600) { intminute = SECOND/60; Second= Second-minute * 60; if(Minute < 10) { if(Second < 10) { return"0" + Minute + ": 0" +second; } return"0" + Minute + ":" +second; } if(Second < 10) { returnMinute + ": 0" +second; } returnMinute + ":" +second; } inthour = second/3600; intminute = (Second-hour * 3600)/60; Second= Second-hour * 3600-minute * 60; if(Hour < 10) { if(Minute < 10) { if(Second < 10) { return"0" + hour + ": 0" + minute + ": 0" +second; } return"0" + hour + ": 0" + minute + ":" +second; } if(Second < 10) { return"0" + hour + Minute + ": 0" +second; } return"0" + hour + Minute + ":" +second; } if(Minute < 10) { if(Second < 10) { returnHour + ": 0" + minute + ": 0" +second; } returnHour + ": 0" + minute + ":" +second; } if(Second < 10) { returnHour + Minute + ": 0" +second; } returnHour + Minute + ":" +second; }
Android clock (seconds shift from second to last)