package net.matrix_rad.watch; import java.lang.*; import java.util.Calendar; import java.util.*; // Temp, until I can figure out the date problem. import java.util.Date; // Need current time for protocol. import net.matrix_rad.skang.*; /** Watch is an experimental front end for a digital watch * that I would like to build one day. * * @.requires Java 1.1.5. * @author David Seikel * @.copyright 2001 David Seikel * @version 0.41 written 2003-10-09 14:30:00 */ public final class Watch extends Skang { public static void main(String someArguments[]) { Skang.main(someArguments); } public void init() { //ERRLN("->Watch.init()"); super.init(); // Should do some error checking on the parameters. if (tz == null) tz = "0"; rightNow.setTime(new Date()); // Java's timezone handling sucks, so do this manually. // rightNow.add(Calendar.HOUR_OF_DAY, (new Integer(tz).intValue()) + TZ_FUDGE); displayNow.setTime(rightNow.getTime()); baseTime.setTime(rightNow.getTime()); baseTime.set(Calendar.HOUR_OF_DAY, 0); baseTime.set(Calendar.MINUTE, 0); baseTime.set(Calendar.SECOND, 0); baseTime.set(Calendar.MILLISECOND, 0); if (modes != null) { modes += " "; isAlarmed = modes.startsWith("A"); isBeeping = modes.startsWith("B", 1) || modes.startsWith("B"); // Leading spaces get stripped. for (short i = 0; i < MODES.length; i++) if (modes.substring(3, 6).equals(MODES[i].substring(0, 3))) currentMode = i; } alarmTime.setTime(new Date()); if (alarm != null) { alarmTime.set(Calendar.HOUR_OF_DAY, (new Integer(alarm.substring(0, 2).trim()).intValue())); alarmTime.set(Calendar.MINUTE, (new Integer(alarm.substring(3, 5).trim()).intValue())); // A bit dodgy for Decimal. } alarmD = calendarToDTime(alarmTime, false).substring(0, 6) + " "; timerTime.setTime(new Date()); if (timer != null) { timerTime.set(Calendar.HOUR_OF_DAY, (new Integer(timer.substring(0, 2).trim()).intValue())); timerTime.set(Calendar.MINUTE, (new Integer(timer.substring(3, 5).trim()).intValue())); timerTime.set(Calendar.SECOND, (new Integer(timer.substring(6, 8).trim()).intValue())); } timerD = calendarToDTime(timerTime, false); startTime.setTime(new Date()); if (stopWatch != null) { startTime.set(Calendar.HOUR_OF_DAY, (new Integer(stopWatch.substring(0, 2).trim()).intValue())); startTime.set(Calendar.MINUTE, (new Integer(stopWatch.substring(3, 5).trim()).intValue())); startTime.set(Calendar.SECOND, (new Integer(stopWatch.substring(6, 8).trim()).intValue())); startTime.set(Calendar.MILLISECOND, (new Integer(stopWatch.substring(9, 11).trim()).intValue()) * 10); } stopWatch = calendarToDTime(startTime, true); lapTime.setTime(new Date()); if (lap != null) { lapTime.set(Calendar.HOUR_OF_DAY, (new Integer(lap.substring(0, 2).trim()).intValue())); lapTime.set(Calendar.MINUTE, (new Integer(lap.substring(3, 5).trim()).intValue())); lapTime.set(Calendar.SECOND, (new Integer(lap.substring(6, 8).trim()).intValue())); lapTime.set(Calendar.MILLISECOND, (new Integer(lap.substring(9, 11).trim()).intValue()) * 10); } lap = calendarToDTime(lapTime, true); //ERRLN("->watch.init(END)"); } public void initGUI() { super.initGUI(); try { Widget.getWidget("Mode"); Widget.getWidget("Time"); } catch (Exception e) {initGUIDone = false;} } public static void alarmBeep() { What.appToolkit.beep(); What.appToolkit.beep(); What.appToolkit.beep(); } public String calendarToDTime(Calendar aCalendar, boolean doHundredths) { // Be carefull, other code relies on fixed formats. // Should set it up that setting the time is only done in 24H, AM, or PM modes. // Probably should pass in the mode rather than relying on the global currentMode. // While this stuff looks a whole lot better with a fixed font, and it usually gets // a variable font, the system is really designed for an 20x2 LCD screen. String aResult = "" + What.padString("00", "" + aCalendar.get(Calendar.HOUR_OF_DAY)) + ":" + What.padString("00", "" + aCalendar.get(Calendar.MINUTE)) + ":" + What.padString("00", "" + aCalendar.get(Calendar.SECOND)) + (doHundredths ? ("." + What.padString("00", "" + (aCalendar.get(Calendar.MILLISECOND) / 10))) : "") + " "; timeOnly = false; switch (currentMode) { case MODE_24HOUR : aResult = "" + What.padString("00", "" + aCalendar.get(Calendar.HOUR_OF_DAY)) + ":" + What.padString("00", "" + aCalendar.get(Calendar.MINUTE)) + ":" + What.padString("00", "" + aCalendar.get(Calendar.SECOND)) + (doHundredths ? ("." + What.padString("00", "" + (aCalendar.get(Calendar.MILLISECOND) / 10))) : "") + " "; break; case MODE_AM : case MODE_PM : int hour = aCalendar.get(Calendar.HOUR_OF_DAY); if (currentState < TIMER_DISPLAY) { if (hour < 12) { currentMode = MODE_AM; } else { hour -= 12; currentMode = MODE_PM; } } aResult = "" + What.padString(" ", "" + hour) + ":" + What.padString("00", "" + aCalendar.get(Calendar.MINUTE)) + ":" + What.padString("00", "" + aCalendar.get(Calendar.SECOND)) + (doHundredths ? ("." + What.padString("00", "" + (aCalendar.get(Calendar.MILLISECOND) / 10))) : "") + " "; break; case MODE_DECIMAL : long millis = aCalendar.getTime().getTime() - baseTime.getTime().getTime(); // Scale 24H millis to Decimal millis. // 10*100*100 = 100000 // 24* 60* 60 = 86400 millis = millis * 100; millis = millis / 864; aResult = "" + What.padString("0", "" + (millis / (100 * 100 * 100))) + ":" + What.padString("00", "" + (millis / (100 * 100))) + ":" + What.padString("00", "" + (millis / 100)) + (doHundredths ? ("." + What.padString("00", "" + millis)) : "") + " "; break; case MODE_SWATCH : Calendar base = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); base.setTime(aCalendar.getTime()); base.add(Calendar.HOUR_OF_DAY, -(new Integer(tz).intValue()) + SWATCH); Calendar base2 = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); base2.setTime(base.getTime()); base.set(Calendar.HOUR_OF_DAY, 0); base.set(Calendar.MINUTE, 0); base.set(Calendar.SECOND, 0); base.set(Calendar.MILLISECOND, 0); millis = base2.getTime().getTime() - base.getTime().getTime(); // Scale 24H millis to Swatch millis. // 10*100 = 1000 // 24* 60* 60 = 86400 millis = millis * 100; millis = millis / 864; aResult = "@" + What.padString("000", "" + (millis / (100 * 100))) + "." + What.padString("00", "" + millis / 100) + (doHundredths ? (What.padString("00", "" + millis)) : "") + " "; break; case MODE_STAR : aResult = "[-29]0000.00"; timeOnly = true; break; case MODE_BINARY : aResult = ""; String hours = What.padString("0000000", Integer.toBinaryString(aCalendar.get(Calendar.HOUR_OF_DAY))); String minutes = What.padString("0000000", Integer.toBinaryString(aCalendar.get(Calendar.MINUTE))); String seconds = What.padString("0000000", Integer.toBinaryString(aCalendar.get(Calendar.SECOND))); String hunds = What.padString("0000000", Integer.toBinaryString(aCalendar.get(Calendar.MILLISECOND) / 10)); for (int i = 0; i < 7; i++) { boolean h = (hours.charAt(i) == '1'); boolean m = (minutes.charAt(i) == '1'); if (h && m) aResult += "="; else if (h && !m) aResult += "-"; else if (!h && m) aResult += "_"; else aResult += " "; } aResult += " "; for (int i = 0; i < 7; i++) { boolean s = (seconds.charAt(i) == '1'); if (doHundredths) { boolean u = (hunds.charAt(i) == '1'); if (s && u) aResult += "="; else if (s && !u) aResult += "-"; else if (!s && u) aResult += "_"; else aResult += " "; } else { if (s) aResult += "-"; else aResult += " "; } } timeOnly = true; break; } return(aResult); } /** Skangs run method will try to call this during it's loop. * All we do here is run the state machine. * * @.modifies The state machine lives here, so of course everything gets modified. */ public void runBit() { //ERR("*"); if (!initGUIDone) return; if ((nextState != IDLE) && (nextState != currentState)) { setState(nextState); // nextState = IDLE; } // This will probably introduce some drift into the system, should // compensate every now and then (once a minute?). backThen.setTime(rightNow.getTime()); rightNow.setTime(new Date()); // Java's timezone handling sucks, so do this manually. // rightNow.add(Calendar.HOUR_OF_DAY, (new Integer(tz).intValue()) + TZ_FUDGE); long millis = rightNow.getTime().getTime() - backThen.getTime().getTime(); displayNow.setTime(new Date(displayNow.getTime().getTime() + millis)); date = calendarToDate(displayNow); time = calendarToTime(displayNow, false); timeD = calendarToDTime(displayNow, false); if ((currentMode == MODE_AM) && (time.equals("12:00:00"))) currentMode = MODE_PM; if (time.equals("00:00:00")) { if (currentMode == MODE_PM) currentMode = MODE_AM; baseTime.setTime(rightNow.getTime()); baseTime.set(Calendar.HOUR_OF_DAY, 0); baseTime.set(Calendar.MINUTE, 0); baseTime.set(Calendar.SECOND, 0); baseTime.set(Calendar.MILLISECOND, 0); } modes = (isAlarmed ? "A" : " ") + (isBeeping ? "B " : " ") + MODES[currentMode]; if (isStopWStarted) { startTime.setTime(new Date(startTime.getTime().getTime() + millis)); stopWatch = calendarToDTime(startTime, true); } if (isTimerStarted) { timerTime.setTime(new Date(timerTime.getTime().getTime() - millis)); timer = calendarToTime(timerTime, false); timerD = calendarToDTime(timerTime, false); } // Surely you jest Sun... switch (displayNow.get(Calendar.DAY_OF_WEEK)) { case Calendar.SUNDAY : day = "Sunday"; break; case Calendar.MONDAY : day = "Monday"; break; case Calendar.TUESDAY : day = "Tuesday"; break; case Calendar.WEDNESDAY : day = "Wednesday"; break; case Calendar.THURSDAY : day = "Thursday"; break; case Calendar.FRIDAY : day = "Friday"; break; case Calendar.SATURDAY : day = "Saturday"; break; } /* Anarchadian time - Decimal time. Ten days per week - [ S M T F W T M F S D ] Sunday dimanxco Monday lundo Tuesday mardo Funday amuztago Wednesday merkredo Thursday xjaxudo Mirthday gajectago Friday vendredo Saturday sabato Dreamday revo 36 days per month. 10 months per year (No february or june) [j m a m j a s o n d]. 5 or 6 day celebration "non-month" at end of year. Call it Yearend. Base weekday, whatever DoW it was on 1961-01-22 is same DoW in Anarchadian calender. Stick with usual year. */ // The watch state machine. switch(currentState) { case TIME_DISPLAY : { setThing("Mode", modes + " " + What.padString(" ", day)); if (timeOnly) setThing("Time", timeD); else setThing("Time", date + " " + timeD); } break; case TIME_SET_MODE : { setThing("Mode", "Mode " + modes); setThing("Time", date + " " + timeD); } break; case TIME_SET_CENTURY : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Century " + What.padString("00", "" + (displayNow.get(Calendar.YEAR) / 100)) + " " + date); } break; case TIME_SET_YEAR : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Year " + What.padString("00", "" + (displayNow.get(Calendar.YEAR) % 100)) + " " + date); } break; case TIME_SET_MONTH : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Month " + What.padString("00", "" + (displayNow.get(Calendar.MONTH) + 1)) + " " + date); } break; case TIME_SET_DAY : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Day " + What.padString("00", "" + displayNow.get(Calendar.DATE)) + " " + date); } break; case TIME_SET_HOUR : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Hour " + What.padString("00", "" + displayNow.get(Calendar.HOUR_OF_DAY)) + " " + time); } break; case TIME_SET_MINUTE : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Minute " + What.padString("00", "" + displayNow.get(Calendar.MINUTE)) + " " + time); } break; case TIME_SET_SECOND : { setThing("Mode", modes + " " + What.padString(" ", day)); setThing("Time", "Seconds " + What.padString("00", "" + displayNow.get(Calendar.SECOND)) + " " + time); } break; case ALARM_DISPLAY : { setThing("Mode", modes + " Time zone " + tz); setThing("Time", "Alarm : " + alarmD); } break; case ALARM_SET_HOUR : { setThing("Mode", modes + " Time zone " + tz); setThing("Time", "Alarm hour " + alarmD); } break; case ALARM_SET_MINUTE : { setThing("Mode", modes + " Time zone " + tz); setThing("Time", "Alarm minute " + alarmD); } break; case ALARM_SET_ALARM : { setThing("Mode", "Alarm " + modes); setThing("Time", "Alarm : " + alarmD); } break; case ALARM_SET_BEEP : { setThing("Mode", "Beep " + modes); setThing("Time", "Alarm : " + alarmD); } break; case TIME_SET_TZ : { setThing("Mode", "Time zone " + tz); setThing("Time", "Alarm : " + alarmD); } break; case TIMER_DISPLAY : { setThing("Mode", " "); setThing("Time", timerD + " " + ( isTimerStarted ? " " : "Stop") + " "); } break; case TIMER_SET_HOUR : { setThing("Mode", " "); setThing("Time", "Timer hour " + timerD); } break; case TIMER_SET_MINUTE : { setThing("Mode", " "); setThing("Time", "Timer minute " + timerD); } break; case TIMER_SET_SECOND : { setThing("Mode", " "); setThing("Time", "Timer seconds " + timerD); } break; case TIMER_START : { nextState = TIMER_DISPLAY; } break; case TIMER_STOP : { nextState = TIMER_DISPLAY; } break; case STOPW_DISPLAY : { setThing("Mode", stopWatch + " " + ( isStopWStarted ? " " : "Stop") + " "); setThing("Time", lap); } break; case STOPW_START : { nextState = STOPW_DISPLAY; } break; case STOPW_STOP : { nextState = STOPW_DISPLAY; } break; case IDLE : { try {showTime();} // Kick things off. catch (SkangException e) {;} } } if (isBeeping) // Shortest beep possible! { String a = calendarToTime(displayNow, true); String b = a.substring(0, 8); if ((!b.equals(lastBeep)) && (a.substring(3, 10).equals("00:00.0"))) { lastBeep = b; What.appToolkit.beep(); } } if (isTimerStarted) // Medium length beep. { if (timer.equals("00:00:00 ")) { isTimerStarted = false; alarmBeep(); alarmBeep(); } } if (isAlarmed && !isLocked) // Will beep many times during these ten seconds, { // that's exactly what I want. String a = ""; a = alarm.substring(0, 5) + ":0"; if (a.equals(time.substring(0, 7))) alarmBeep(); } } /** Select part of time to set. * * @.skang select * @.modifies nextState */ public void selectPart() { if (isLocked) { // if (nextState == IDLE) // nextState = currentState; nextState++; switch (nextState) { case TIME_DISPLAY : nextState = TIME_SET_MODE; break; case ALARM_DISPLAY : nextState = TIME_SET_MODE; break; case TIMER_DISPLAY : nextState = ALARM_SET_HOUR; break; case TIMER_START : case TIMER_STOP : case STOPW_DISPLAY : nextState = TIMER_SET_HOUR; break; } } } /** Change the current time part. * * @.skang setpart * @.modifies currentMode */ public void setPart() { // We will have to get tricky to support Decimal. if (isLocked) { switch (currentState) { case TIME_SET_MODE : currentMode++; // Sanity check AM/PM modes. if (currentMode == MODE_PM) currentMode++; if (currentMode > 6) currentMode = 0; break; case TIME_SET_CENTURY : displayNow.add(Calendar.YEAR, 100); if (displayNow.get(Calendar.YEAR) > 9999) displayNow.set(Calendar.YEAR, 0); break; case TIME_SET_YEAR : displayNow.roll(Calendar.YEAR, true); break; case TIME_SET_MONTH : displayNow.roll(Calendar.MONTH, true); break; case TIME_SET_DAY : displayNow.roll(Calendar.DATE, true); break; case TIME_SET_HOUR : displayNow.roll(Calendar.HOUR_OF_DAY, true); break; case TIME_SET_MINUTE : displayNow.roll(Calendar.MINUTE, true); break; case TIME_SET_SECOND : displayNow.roll(Calendar.SECOND, true); break; case ALARM_SET_HOUR : alarmTime.roll(Calendar.HOUR_OF_DAY, true); isAlarmed = true; break; case ALARM_SET_MINUTE : alarmTime.roll(Calendar.MINUTE, true); isAlarmed = true; break; case TIMER_SET_HOUR : timerTime.roll(Calendar.HOUR_OF_DAY, true); break; case TIMER_SET_MINUTE : timerTime.roll(Calendar.MINUTE, true); break; case TIMER_SET_SECOND : timerTime.roll(Calendar.SECOND, true); break; case ALARM_SET_ALARM : isAlarmed = !isAlarmed; break; case ALARM_SET_BEEP : isBeeping = !isBeeping; break; case TIME_SET_TZ : break; } alarm = calendarToTime(alarmTime, false).substring(0, 5) + " "; alarmD = calendarToDTime(alarmTime, false).substring(0, 5) + " "; timer = calendarToTime(timerTime, false); timerD = calendarToDTime(timerTime, false); } } /** Show the time. * * @.skang time * @.modifies nextState */ public void showTime() throws SkangException { nextState = TIME_DISPLAY; showThing(); } /** Show the alarm. * * @.skang alarm * @.modifies nextState */ public void showAlarm() throws SkangException { nextState = ALARM_DISPLAY; showThing(); } /** Show the timer. * * @.skang timer * @.modifies nextState */ public void showTimer() throws SkangException { nextState = TIMER_DISPLAY; showThing(); } /** Show the stopwatch. * * @.skang stopwatch * @.modifies nextState */ public void showStopW() throws SkangException { nextState = STOPW_DISPLAY; showThing(); } /** Commom showX() code. * * @.modifies isLocked */ private void showThing() throws SkangException { isLocked = true; toggleLock(); } /** Syncronize with an NTP time server. * * @.skang sync */ public void syncNTP() { } /** Lap / reset the stopwatch. * * @.skang lap * @.modifies lap, lapTime */ public void toggleLap() { if (isStopWStarted) { lapTime = startTime; lap = calendarToDTime(lapTime, true); } else { startTime.set(Calendar.HOUR_OF_DAY, 0); startTime.set(Calendar.MINUTE, 0); startTime.set(Calendar.SECOND, 0); startTime.set(Calendar.MILLISECOND, 0); stopWatch = calendarToDTime(startTime, true); setThing("Mode", stopWatch); lapTime.set(Calendar.HOUR_OF_DAY, 0); lapTime.set(Calendar.MINUTE, 0); lapTime.set(Calendar.SECOND, 0); lapTime.set(Calendar.MILLISECOND, 0); lap = calendarToDTime(lapTime, true); setThing("Time", lap); } } /** Toggle the background light. * * @.skang light * @.modifies isLighted */ public void toggleLight() { isLighted = !isLighted; OUTLN("Light is now " + (isLighted ? "on" : "off") + "."); } /** Toggle setup mode. * * @.skang lock * @.modifies isLocked, nextState */ public void toggleLock() throws SkangException { isLocked = !isLocked; if (isLocked) { if (nextState == STOPW_DISPLAY) nextState = STOPW_START; else if (nextState == TIMER_DISPLAY) nextState = TIMER_SET_HOUR; else if (nextState == ALARM_DISPLAY) nextState = ALARM_SET_HOUR; else if (nextState == TIME_DISPLAY) nextState = TIME_SET_MODE; else if (nextState == IDLE) nextState = TIME_SET_MODE; } else { if (nextState >= STOPW_DISPLAY) nextState = STOPW_DISPLAY; else if (nextState >= TIMER_DISPLAY) nextState = TIMER_DISPLAY; else if (nextState >= ALARM_DISPLAY) nextState = ALARM_DISPLAY; else //if (currentState >= TIME_DISPLAY) nextState = TIME_DISPLAY; } } /** Start / stop the stopwatch. * * @.skang start * @.modifies isStopWStarted */ public void toggleStart() { isStopWStarted = !isStopWStarted; } /** Start / stop the timer. * * @.skang starttimer * @.modifies isTimerStarted */ public void toggleTimer() { isTimerStarted = !isTimerStarted; } //********************************************************************** // I should add others - stardates, discordian dates, whatever else is out there. // I really mean out there B-). // Discordian dates - only relates to dates, and they tend to have very long names that may not fit. // Millennium clock - Claims to be a new idea for displaying time, but it's just a // blocky looking analog clock with the seconds hand running backwards. public final static String[] MODES = { "24H", "AM ", "PM ", "Dec", "Swa", "Sta", "Bin" }; final static short TIME_DISPLAY = 1; final static short TIME_SET_MODE = 2; final static short TIME_SET_CENTURY = 3; final static short TIME_SET_YEAR = 4; final static short TIME_SET_MONTH = 5; final static short TIME_SET_DAY = 6; final static short TIME_SET_HOUR = 7; final static short TIME_SET_MINUTE = 8; final static short TIME_SET_SECOND = 9; final static short ALARM_DISPLAY = 10; final static short ALARM_SET_HOUR = 11; final static short ALARM_SET_MINUTE = 12; final static short TIME_SET_TZ = 13; final static short ALARM_SET_ALARM = 14; final static short ALARM_SET_BEEP = 15; final static short TIMER_DISPLAY = 16; final static short TIMER_SET_HOUR = 17; final static short TIMER_SET_MINUTE = 18; final static short TIMER_SET_SECOND = 19; final static short TIMER_START = 20; final static short TIMER_STOP = 21; final static short STOPW_DISPLAY = 22; final static short STOPW_START = 23; final static short STOPW_STOP = 24; final static short MODE_24HOUR = 0; final static short MODE_AM = 1; final static short MODE_PM = 2; final static short MODE_DECIMAL = 3; final static short MODE_SWATCH = 4; final static short MODE_STAR = 5; final static short MODE_BINARY = 6; final static short SWATCH = 1; // I don't reaaly know, this is for testing, seems about right. // I just compared this to a swatch app I have, and they now agree. I'll double check it later. final static int TZ_FUDGE = 0; //********************************************************************** /** Watch modes. * * @.skangarg modes * @.default " 24H" */ public static String modes = null; /** Time zone. * * @.skangarg tz * @.default "00" */ public static String tz = null; /** Alarm time. * * @.skangarg alarm * @.default "00:00" */ public static String alarm = null; private static String alarmD = null; //"??:??"; /** Timer time. * * @.skangarg timer * @.default "00:00:00" */ public static String timer = null; private static String timerD = null; //"??:??:??"; /** Stopwatch stop time. * * @.skangarg stopwatch * @.default "00:00:00.00" */ public static String stopWatch = null; /** Stopwatch lap time. * * @.skangarg lap * @.default "00:00:00.00" */ public static String lap = null; private static String day = "Dunnoday"; private static String date = "????-??-??"; private static String time = "??:??:??"; private static String timeD = "??:??:??"; private static String lastBeep = "??:??:??"; private static boolean isLighted = false; private static boolean isLocked = false; private static boolean isTimerStarted = false; private static boolean isStopWStarted = false; private static boolean isBeeping = false; private static boolean isAlarmed = false; private static boolean timeOnly = false; private static short currentMode = MODE_24HOUR; private static short nextState = IDLE; private static Calendar displayNow = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar rightNow = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar backThen = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar alarmTime = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar timerTime = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar startTime = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar lapTime = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); private static Calendar baseTime = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); }