const ::mailer::type::RawMailText Mail::Compose() const { BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Function call"; ::mailer::type::RawMailText raw_mail; BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Adding date: " << ::type::ToString(day_) << "; " << timestamp_.ToString() << "; " << time_zone_; raw_mail += "Date: " + ::type::ToString(day_) + ", " + std::to_string(timestamp_.GetDate().GetDay()) + " " + MonthToString(timestamp_.GetDate().GetMonth()) + " " + std::to_string(timestamp_.GetDate().GetYear()) + " " + timestamp_.GetTime().ToString() + " " + time_zone_ + "\r\n"; BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Adding 'To' recipients"; for (const auto &i : to_) { BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: 'Tc' recipient: " << i; raw_mail += "To: " + i + "\r\n"; } BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Adding 'Cc' recipients"; for (const auto &i : cc_) { BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: 'Cc' recipient: " << i; raw_mail += "Cc: " + i + "\r\n"; } BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Adding 'From' field: " << from_; raw_mail += "From: " + from_ + "\r\n"; BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Adding subject: " << subject_; raw_mail += "Subject: " + subject_ + "\r\n"; BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Adding message body"; raw_mail += "\r\n"; raw_mail += body_; BOOST_LOG_TRIVIAL(debug) << "mailer::Mail::Compose: Message composed"; return raw_mail; }
void ScreenSetTime::Update( float fDelta ) { Screen::Update( fDelta ); time_t iNow = time(NULL); iNow += m_TimeOffset; tm now; localtime_r( &iNow, &now ); int iPrettyHour = now.tm_hour%12; if( iPrettyHour == 0 ) iPrettyHour = 12; RString sPrettyHour = ssprintf( "%d %s", iPrettyHour, now.tm_hour>=12 ? "pm" : "am" ); m_textValue[hour] .SetText( sPrettyHour ); m_textValue[minute] .SetText( ssprintf("%02d",now.tm_min) ); m_textValue[second] .SetText( ssprintf("%02d",now.tm_sec) ); m_textValue[year] .SetText( ssprintf("%02d",now.tm_year+1900) ); m_textValue[month] .SetText( MonthToString((Month)now.tm_mon) ); m_textValue[day] .SetText( ssprintf("%02d",now.tm_mday) ); }
GChar * System::FormatTimeDate( GChar * strOutput, const TimeDate & hTimeDate ) const { return StringFn->Format( strOutput, TEXT("%s %s, %ud %ud %u2d:%u2d:%u2d"), DayToString(hTimeDate.iDayOfWeek), MonthToString(hTimeDate.iMonth), hTimeDate.iDay, hTimeDate.iYear, hTimeDate.iHours, hTimeDate.iMinutes, hTimeDate.iSeconds ); }
GChar * System::FormatDate( GChar * strOutput, const TimeDate & hTimeDate ) const { return StringFn->Format( strOutput, TEXT("%s %s, %ud %ud"), DayToString(hTimeDate.iDayOfWeek), MonthToString(hTimeDate.iMonth), hTimeDate.iDay, hTimeDate.iYear ); }
tm GetNextSunday(tm start) { return AddDays(start, DAYS_IN_WEEK - GetDayOfWeek(start)); } tm GetDayInYearAndYear(int iDayInYearIndex, int iYear) { tm when; ZERO(when); when.tm_mon = 0; when.tm_mday = iDayInYearIndex + 1; when.tm_year = iYear - 1900; time_t then = mktime(&when); localtime_r(&then, &when); return when; } LuaFunction(MonthToString, MonthToString(Enum::Check<Month>(L, 1))); LuaFunction( MonthToLocalizedString, MonthToLocalizedString( Enum::Check<Month>(L, 1) ) ); LuaFunction(MonthOfYear, GetLocalTime().tm_mon); LuaFunction(DayOfMonth, GetLocalTime().tm_mday); LuaFunction(Hour, GetLocalTime().tm_hour); LuaFunction(Minute, GetLocalTime().tm_min); LuaFunction(Second, GetLocalTime().tm_sec); LuaFunction(Year, GetLocalTime().tm_year + 1900); LuaFunction(Weekday, GetLocalTime().tm_wday); LuaFunction(DayOfYear, GetLocalTime().tm_yday);
"June", "July", "August", "September", "October", "November", "December", }; CString MonthToString( int iMonthIndex ) { if( iMonthIndex < 0 || iMonthIndex >= (int) sizeof(MONTH_TO_NAME) ) return ""; return MONTH_TO_NAME[iMonthIndex]; } LuaFunction( MonthToString, MonthToString( IArg(1) ) ); CString LastWeekToString( int iLastWeekIndex ) { switch( iLastWeekIndex ) { case 0: return "ThisWeek"; break; case 1: return "LastWeek"; break; default: return ssprintf("Week%02dAgo",iLastWeekIndex); break; } } CString LastDayToDisplayString( int iLastDayIndex ) { CString s = LastDayToString( iLastDayIndex ); s.Replace( "Day", "" );