Fixed checkAndCutOffDateWithSec to work with AM/PM

master
Hecklezz 2025-11-04 03:06:54 +10:00
parent f9e7f78787
commit 3bec0edebc
1 changed files with 10 additions and 14 deletions

View File

@ -209,6 +209,10 @@ public:
// <FS:Ansariel> Seconds in timestamps // <FS:Ansariel> Seconds in timestamps
void checkAndCutOffDateWithSec(std::string& time_str) void checkAndCutOffDateWithSec(std::string& time_str)
{ {
if (time_str.size() < 10) // not enough space for a date
{
return;
}
// Cuts off the "%Y/%m/%d" from string for todays timestamps. // Cuts off the "%Y/%m/%d" from string for todays timestamps.
// Assume that passed string has at least "%H:%M:%S" time format. // Assume that passed string has at least "%H:%M:%S" time format.
date log_date(not_a_date_time); date log_date(not_a_date_time);
@ -225,20 +229,12 @@ public:
if ( days_alive == zero_days ) if ( days_alive == zero_days )
{ {
// Yep, today's so strip "%Y/%m/%d" info size_t pos = time_str.find_first_of(' ');
ptime stripped_time(not_a_date_time); if (pos != std::string::npos)
{
mTimeSecStream.str(LLStringUtil::null); time_str.erase(0, pos + 1);
mTimeSecStream << time_str; LLStringUtil::trim(time_str);
mTimeSecStream >> stripped_time; }
mTimeSecStream.clear();
time_str.clear();
mTimeSecStream.str(LLStringUtil::null);
mTimeSecStream << stripped_time;
mTimeSecStream >> time_str;
mTimeSecStream.clear();
} }
LL_DEBUGS("LLChatLogParser") LL_DEBUGS("LLChatLogParser")