std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // PDT/PDS is totally irrelevant static const LLCachedControl<bool> use_local_time("RtyChatUsesLocalTime"); if(use_local_time) { // use local time timep = std::localtime(&utc_time); } else { // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); } static const LLCachedControl<bool> show_seconds("SecondsInChatAndIMs"); static const LLCachedControl<std::string> format_long("LongTimeFormat"); static const LLCachedControl<std::string> format_short("ShortTimeFormat"); std::string format = show_seconds ? format_long : format_short; std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { // Format time according to the person's settings -- MC /*time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); text = llformat("[%02d:%02d] ", timep->tm_hour, timep->tm_min); appendColoredText(text, false, prepend_newline, LLColor4::grey);*/ std::string text = llformat("[%02d:%02d", gViewerTime->getCurHour(), gViewerTime->getCurMin()); if (!gViewerTime->getCurAMPM().empty()) { //text += " "; text += gViewerTime->getCurAMPM(); } text += "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string format = ""; if (gSavedSettings.getBOOL("SecondsInChatAndIMs")) { format = gSavedSettings.getString("LongTimeFormat"); } else { format = gSavedSettings.getString("ShortTimeFormat"); } std::string text; timeStructToFormattedString(timep, format, text); text = "[" + text + "] "; appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }
std::string LLViewerTextEditor::appendTime(bool prepend_newline) { time_t utc_time; utc_time = time_corrected(); // There's only one internal tm buffer. struct tm* timep; // Convert to Pacific, based on server's opinion of whether // it's daylight savings time there. timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); std::string text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); appendColoredText(text, false, prepend_newline, LLColor4::grey); return text; }