diff options
Diffstat (limited to 'linhes/mythtv/negative_time_values.patch')
-rw-r--r-- | linhes/mythtv/negative_time_values.patch | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/linhes/mythtv/negative_time_values.patch b/linhes/mythtv/negative_time_values.patch new file mode 100644 index 0000000..7e15d19 --- /dev/null +++ b/linhes/mythtv/negative_time_values.patch @@ -0,0 +1,25 @@ +diff --git a/mythtv/libs/libmythbase/mythdate.cpp b/mythtv/libs/libmythbase/mythdate.cpp +index 8f3397241a6..21a307cb453 100644 +--- a/mythtv/libs/libmythbase/mythdate.cpp ++++ b/mythtv/libs/libmythbase/mythdate.cpp +@@ -237,6 +237,9 @@ QString formatTime(std::chrono::milliseconds msecs, QString fmt) + static const QRegularExpression sRe("s+"); + static const QRegularExpression zRe("z+"); + ++ bool negativeTime = msecs < 0ms; ++ msecs = std::chrono::milliseconds(std::abs(msecs.count())); ++ + QRegularExpressionMatch match = hRe.match(fmt); + if (match.hasMatch()) + { +@@ -272,6 +275,10 @@ QString formatTime(std::chrono::milliseconds msecs, QString fmt) + QString text = StringUtil::intToPaddedString(value, width); + fmt.replace(match.capturedStart(), match.capturedLength(), text); + } ++ ++ if (negativeTime) ++ fmt.prepend("-"); ++ + return fmt; + } + |