static bool getYesterdayTodayAndTomorrow(JNIEnv* env, jobject localeData, const Locale& locale, const char* locale_name) { UErrorCode status = U_ZERO_ERROR; ScopedResourceBundle root(ures_open(NULL, locale_name, &status)); ScopedResourceBundle fields(ures_getByKey(root.get(), "fields", NULL, &status)); ScopedResourceBundle day(ures_getByKey(fields.get(), "day", NULL, &status)); ScopedResourceBundle relative(ures_getByKey(day.get(), "relative", NULL, &status)); if (U_FAILURE(status)) { return false; } UnicodeString yesterday(ures_getUnicodeStringByKey(relative.get(), "-1", &status)); UnicodeString today(ures_getUnicodeStringByKey(relative.get(), "0", &status)); UnicodeString tomorrow(ures_getUnicodeStringByKey(relative.get(), "1", &status)); if (U_FAILURE(status)) { ALOGE("Error getting yesterday/today/tomorrow for %s: %s", locale_name, u_errorName(status)); return false; } // We title-case the strings so they have consistent capitalization (http://b/14493853). UniquePtr<BreakIterator> brk(BreakIterator::createSentenceInstance(locale, status)); if (U_FAILURE(status)) { ALOGE("Error getting yesterday/today/tomorrow break iterator for %s: %s", locale_name, u_errorName(status)); return false; } yesterday.toTitle(brk.get(), locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT); today.toTitle(brk.get(), locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT); tomorrow.toTitle(brk.get(), locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT); setStringField(env, localeData, "yesterday", yesterday); setStringField(env, localeData, "today", today); setStringField(env, localeData, "tomorrow", tomorrow); return true; }
int main() { scanf("%d-%d-%d", &y, &m, &d); tomorrow(); printf("%d-%02d-%02d\n", year, month, day); return 0; }
void CPigeonScheduledSend::PopulateOffPeakListL() { //There are no existing off peak times set up //So no need to remember them iOffPeakList->Reset(); TTime t; TDateTime d; t.HomeTime(); t -= TTimeIntervalHours(1); d = t.DateTime(); TTimeIntervalMinutes twoHours = 120; TMsvOffPeakTime current(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours); iOffPeakList->AppendL(current); t -= TTimeIntervalDays(1); d = t.DateTime(); TMsvOffPeakTime yesterday(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours); iOffPeakList->AppendL(yesterday); t += TTimeIntervalDays(2); d = t.DateTime(); TMsvOffPeakTime tomorrow(t.DayNoInWeek(), d.Hour(), d.Minute(), twoHours); iOffPeakList->AppendL(tomorrow); }
void HistoryManager::startFrecencyTimer() { // schedule us to recalculate the frecencies once per day, at 3:00 am (aka 03h00) QDateTime tomorrow(QDate::currentDate().addDays(1), QTime(3, 00)); m_frecencyTimer.start(QDateTime::currentDateTime().secsTo(tomorrow) * 1000); }