/** * get seconds from a time format * * @param t */ public void getSeconds(TimeFormat t) { if (t.remainder >= ONE_SECOND && t.remainder < ONE_MINUTE) { t.seconds = (t.remainder / ONE_SECOND); t.milliseconds = t.remainder -= (t.seconds * ONE_SECOND); } else { t.seconds = 0; t.milliseconds = t.remainder; } }
/** format with a date time */ public static String format(String format, long time) { TimeFormat f = new TimeFormat(time); return f.parse( format, f.getDays(), f.getHours(), f.getMinutes(), f.getSeconds(), f.getMilliseconds()); }
/** * return a string formatted version of time <code>t</code> rounding to <code>round</code> * * @param t * @param round * @return String value */ public static String valueOf(long t, int round) { TimeFormat f = new TimeFormat(t, round); return f.toString(); }
/** * update time * * @param t */ public void getTime(TimeFormat t) { t.getTime(); }
/** * get minutes from a time format * * @param t */ public void getMinutes(TimeFormat t) { if (t.remainder >= ONE_MINUTE && t.remainder < ONE_HOUR) { t.minutes = (t.remainder / ONE_MINUTE); t.remainder -= (t.minutes * ONE_MINUTE); } }
/** * get hours from a time format * * @param t */ public void getHours(TimeFormat t) { if (t.remainder >= ONE_HOUR && t.remainder < ONE_DAY) { t.hours = (t.remainder / ONE_HOUR); t.remainder -= (t.hours * ONE_HOUR); } }
/** * get days from a time format * * @param t */ public void getDays(TimeFormat t) { if (t.remainder >= ONE_DAY) { t.days = (t.remainder / ONE_DAY); t.remainder -= (t.days * ONE_DAY); } }