TINI Clock changed time suddenly..
"Kunal Shah" <[email protected]> Tue, 15 Jun 2004 15:22:08 -0500
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <007d01c45316$6f3114d0$a60a0a0a@KunalShah> |
This might be the weirdest thing I have ever seen on TINI. One of our device (TINIm-400 using dallas semiconductors development boards) on the field suddenly started reporting wrong time of Jan 10, 2004. The same device was working fine till Saturday morning with correct time (June 12 2004) but suddenly on the same day it started reporting with strange time-stamps. We are not modifying TINI's clock anywhere inside our program..Also there are currently installed on one of our client's site and no one has changed date on it. Can anyone has ever seen this type of behavior? What can cause that? The first obvious doubt can be on the way we are generating time-stamps that we are using on device and send to our server.. I have included the snippet of code where we are generating this time-stamp..just in case I am not seeing anything obvious.. Also the change of date was not one-time thing.. but actually it seems to have some-how set its RTC to Jan, 2004. It has reported Jan 10, 11 and 12 instead of June 12, 13 and 14... I will greatly appreciate any ideas about possible causes for this behavior.. Thanks.. Kunal Shah Development SensorLogic | M2M made easy. 972-934-7375 x 2121 972-934-7376 (fax) [email protected] www.Sensorlogic.com FORMAT OF TIMESTAMP WE HAVE USED IS YYYYMMDDhhmm Y-year; M-month; D-day; h-hour; m-minute where month is 1 based and zero padded if its a single digit (i.e. Jan - 01, Feb - 02 etc.) /** * This method is used to generate the string representation of the timestamp * @param date the date object the timestamp should be generated from * @param includeSeconds true if the result should specify seconds * @return */ public static String generateTimeStampAttribute(Date date, boolean includeSeconds) { if (date == null) { return " "; } String ts = "ts=\""; Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); c.setTime(date); ts += Integer.toString(c.get(Calendar.YEAR)); ts += get2DigitField(Calendar.MONTH, c); //month is 0-based ts += get2DigitField(Calendar.DAY_OF_MONTH, c); ts += get2DigitField(Calendar.HOUR_OF_DAY, c); ts += get2DigitField(Calendar.MINUTE, c); if (includeSeconds) { ts += get2DigitField(Calendar.SECOND, c); } return ts + "\""; } /** * This method will zero pad a date field if necessary and adjust the month field to be 1 based * @param field the Calendar field to be returned * @param calendar The calendar object the field will be extracted from * @return */ private static String get2DigitField(int field, Calendar calendar) { int val = calendar.get(field); if (field == Calendar.MONTH) { val++; //month is zero based } String valAsString = Integer.toString(val); if (valAsString.length() < 2) { valAsString = "0" + valAsString; } return valAsString; } _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini