[pim/kcalutils] /: Remove the now unused tzUTCOffsetStr

Volker Krause <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit bef90b399234da0e16fd42f95efca8ba220a2cc0 by Volker Krause.
Committed on 10/08/2026 at 15:03.
Pushed by vkrause into branch 'master'.

Remove the now unused tzUTCOffsetStr

M  +0    -27   autotests/teststringify.cpp
M  +0    -1    autotests/teststringify.h
M  +0    -17   src/stringify.cpp
M  +0    -7    src/stringify.h

https://invent.kde.org/pim/kcalutils/-/commit/bef90b399234da0e16fd42f95efca8ba220a2cc0

diff --git a/autotests/teststringify.cpp b/autotests/teststringify.cpp
index d5eb4010b..e1300a133 100644
--- a/autotests/teststringify.cpp
+++ b/autotests/teststringify.cpp
@@ -71,31 +71,4 @@ void StringifyTest::testDateTimeStrings()
     // TODO
 }
 
-void StringifyTest::testUTCoffsetStrings()
-{
-    const QTimeZone tz1(5 * 60 * 60); // 5 hrs
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz1), QStringLiteral("+05:00"));
-
-    const QTimeZone tz2(-5 * 60 * 60); //-5 hrs
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz2), QStringLiteral("-05:00"));
-
-    const QTimeZone tz3(0);
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz3), QStringLiteral("+00:00"));
-
-    const QTimeZone tz4(30 * 60 * 60); // 30 hrs -- out-of-range
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz4), QStringLiteral("+00:00"));
-
-    const QTimeZone tz5((5 * 60 * 60) + (30 * 60)); // 5:30
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz5), QStringLiteral("+05:30"));
-
-    const QTimeZone tz6(-((11 * 60 * 60) + (59 * 60))); //-11:59
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz6), QStringLiteral("-11:59"));
-
-    const QTimeZone tz7(12 * 60 * 60); // 12:00
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz7), QStringLiteral("+12:00"));
-
-    const QTimeZone tz8(-((12 * 60 * 60) + (59 * 60))); //-12:59
-    QCOMPARE(Stringify::tzUTCOffsetStr(tz8), QStringLiteral("-12:59"));
-}
-
 #include "moc_teststringify.cpp"
diff --git a/autotests/teststringify.h b/autotests/teststringify.h
index 9a5ed74a6..7a956f0c7 100644
--- a/autotests/teststringify.h
+++ b/autotests/teststringify.h
@@ -18,5 +18,4 @@ private Q_SLOTS:
     void testAttendeeStrings();
     void testAlarmStrings();
     void testDateTimeStrings();
-    void testUTCoffsetStrings();
 };
diff --git a/src/stringify.cpp b/src/stringify.cpp
index 22deca00e..5056586c4 100644
--- a/src/stringify.cpp
+++ b/src/stringify.cpp
@@ -211,20 +211,3 @@ QString Stringify::errorMessage(const Exception &exception)
 
     return message;
 }
-
-QString Stringify::tzUTCOffsetStr(const QTimeZone &tz)
-{
-    int const currentOffset = tz.offsetFromUtc(QDateTime::currentDateTimeUtc());
-    int const absOffset = qAbs(currentOffset);
-    int const utcOffsetHrs = absOffset / 3600; // in hours
-    int const utcOffsetMins = (absOffset % 3600) / 60; // in minutes
-
-    const QString hrStr = QStringLiteral("%1").arg(utcOffsetHrs, 2, 10, QLatin1Char('0'));
-    const QString mnStr = QStringLiteral("%1").arg(utcOffsetMins, 2, 10, QLatin1Char('0'));
-
-    if (currentOffset < 0) {
-        return QStringLiteral("-%1:%2").arg(hrStr, mnStr);
-    } else {
-        return QStringLiteral("+%1:%2").arg(hrStr, mnStr);
-    }
-}
diff --git a/src/stringify.h b/src/stringify.h
index f3a25c8b9..b8e2656b8 100644
--- a/src/stringify.h
+++ b/src/stringify.h
@@ -74,13 +74,6 @@ namespace Stringify
  */
 [[nodiscard]] KCALUTILS_EXPORT QString alarmType(KCalendarCore::Alarm::Type alarmType);
 
-/*!
-  Returns a string containing the UTC offset of the specified QTimeZone \a tz (relative to the current date).
-  The format is [+-]HH::MM, according to standards.
-  \since 5.8
-*/
-[[nodiscard]] KCALUTILS_EXPORT QString tzUTCOffsetStr(const QTimeZone &tz);
-
 /*!
    Build a translated message representing an exception
 */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.