diff --git a/.gitmodules b/.gitmodules index a6ac3f38..3dbc5cdc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "lib/settings"] path = lib/settings url = https://github.com/pajlada/settings +[submodule "lib/humanize"] + path = lib/humanize + url = https://github.com/pajlada/humanize.git diff --git a/chatterino.pro b/chatterino.pro index bef51843..2c041f12 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -195,3 +195,4 @@ werr { # External dependencies include(dependencies/rapidjson.pri) include(dependencies/settings.pri) +include(dependencies/humanize.pri) diff --git a/dependencies/humanize.pri b/dependencies/humanize.pri new file mode 100644 index 00000000..3d1510d2 --- /dev/null +++ b/dependencies/humanize.pri @@ -0,0 +1,2 @@ +# settings +INCLUDEPATH += $$PWD/../lib/humanize/include/ diff --git a/lib/humanize b/lib/humanize new file mode 160000 index 00000000..4e00a036 --- /dev/null +++ b/lib/humanize @@ -0,0 +1 @@ +Subproject commit 4e00a03623966723f23ca3034c1ad944009cd7be diff --git a/src/messages/messagebuilder.cpp b/src/messages/messagebuilder.cpp index d39c8e58..5171287f 100644 --- a/src/messages/messagebuilder.cpp +++ b/src/messages/messagebuilder.cpp @@ -33,14 +33,15 @@ void MessageBuilder::appendTimestamp(time_t time) { char timeStampBuffer[69]; + // Add word for timestamp with no seconds strftime(timeStampBuffer, 69, "%H:%M", localtime(&time)); - QString timestamp = QString(timeStampBuffer); - - strftime(timeStampBuffer, 69, "%H:%M:%S", localtime(&time)); - QString timestampWithSeconds = QString(timeStampBuffer); - - appendWord(Word(timestamp, Word::TimestampNoSeconds, + QString timestampNoSeconds(timeStampBuffer); + appendWord(Word(timestampNoSeconds, Word::TimestampNoSeconds, ColorScheme::getInstance().SystemMessageColor, QString(), QString())); + + // Add word for timestamp with seconds + strftime(timeStampBuffer, 69, "%H:%M:%S", localtime(&time)); + QString timestampWithSeconds(timeStampBuffer); appendWord(Word(timestampWithSeconds, Word::TimestampWithSeconds, ColorScheme::getInstance().SystemMessageColor, QString(), QString())); }