diff --git a/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java b/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java index a8b720720..b34da280a 100644 --- a/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java +++ b/app/src/main/java/com/android/calendar/widget/CalendarAppWidgetModel.java @@ -48,10 +48,13 @@ class CalendarAppWidgetModel { private boolean mShowTZ; public CalendarAppWidgetModel(Context context, String timeZone) { + Log.d(TAG, "CAWM: timeZone=" + timeZone); mNow = System.currentTimeMillis(); Time time = new Time(timeZone); time.set(mNow); // This is needed for gmtoff to be set mTodayJulianDay = Time.getJulianDay(mNow, time.getGmtOffset()); + Log.d(TAG, "CAWM: time.gGO=" + time.getGmtOffset()); + Log.d(TAG, "CAWM: mTJD=" + mTodayJulianDay); mMaxJulianDay = mTodayJulianDay + CalendarAppWidgetService.MAX_DAYS - 1; mEventInfos = new ArrayList(50); mRowInfos = new ArrayList(50); @@ -60,6 +63,7 @@ public CalendarAppWidgetModel(Context context, String timeZone) { } public void buildFromCursor(Cursor cursor, String timeZone) { + Log.d(TAG, "bFC: timeZone=" + timeZone); final Time recycle = new Time(timeZone); final ArrayList> mBuckets = new ArrayList>(CalendarAppWidgetService.MAX_DAYS); @@ -203,12 +207,22 @@ private EventInfo populateEventInfo(long eventId, boolean allDay, long start, lo } private DayInfo populateDayInfo(int julianDay, Time recycle) { + Log.d(TAG, "pDI: jD=" + julianDay); + final int EPOCH_JULIAN_DAY = 2440588; + final long HOUR_IN_MILLIS = 60 * 60 * 1000; + final long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS; + long millis = recycle.setJulianDay(julianDay); int flags = DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_WEEKDAY; + long tmpMillis = (julianDay - EPOCH_JULIAN_DAY) * DAY_IN_MILLIS; + Log.d(TAG, "pDI: tmpMillis=" + tmpMillis); + Log.d(TAG, "pDI: gjD(tmpMillis, recycle.gGO)=" + Time.getJulianDay(tmpMillis, recycle.getGmtOffset())); + Log.d(TAG, "pDI: monthDay correction: =" + (julianDay - Time.getJulianDay(tmpMillis, recycle.getGmtOffset()))); + String label; if (julianDay == mTodayJulianDay + 1) { label = mContext.getString(R.string.agenda_tomorrow,