Advertisement
riking

Is this overboard?

Jun 21st, 2012
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. Calendar c = Calendar.getInstance();
  2. c.setTimeInMillis(new Date().getTime() - gameStart.getTime());
  3. StringBuilder sb = new StringBuilder("Run time: ");
  4. if(c.get(Calendar.HOUR) != 0) {
  5.     sb.append(c.get(Calendar.HOUR));
  6.     sb.append(" hours ");
  7. }
  8. if(c.get(Calendar.MINUTE) != 0) {
  9.     sb.append(c.get(Calendar.MINUTE));
  10.     sb.append(" minutes ");
  11. }
  12. if(c.get(Calendar.SECOND) != 0) {
  13.     sb.append(c.get(Calendar.SECOND));
  14.     sb.append(" seconds ");
  15. }
  16. if(c.get(Calendar.MILLISECOND) != 0) {
  17.     sb.append(c.get(Calendar.MILLISECOND));
  18.     sb.append(" milliseconds");
  19. }
  20.  
  21. Shocky.sendChannel(bot, channel, sb.toString());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement