util: Drop now unused purple_get_tzoff_str()

Fri, 14 Jul 2017 15:18:08 -0500

author
Mike Ruprecht <cmaiku@gmail.com>
date
Fri, 14 Jul 2017 15:18:08 -0500
changeset 39018
fb92456f11ca
parent 39017
4c9d510555b5
child 39019
da046e7a0d2b

util: Drop now unused purple_get_tzoff_str()

Now that purple_get_tzoff_str() is unused, this patch removes it.

ChangeLog.API file | annotate | diff | comparison | revisions
libpurple/util.c file | annotate | diff | comparison | revisions
libpurple/util.h file | annotate | diff | comparison | revisions
--- a/ChangeLog.API	Wed Apr 25 15:30:53 2018 -0500
+++ b/ChangeLog.API	Fri Jul 14 15:18:08 2017 -0500
@@ -428,6 +428,7 @@
 		  event loop yourself. See GLib Main Event Loop docs.
 		* PurpleEventLoopUiOps. Manually drive the GLib event loop
 		  yourself. See GLib Main Event Loop docs.
+		* purple_get_tzoff_str(). Use g_date_time_format, instead.
 		* purple_network_listen_family. Use purple_network_listen, instead.
 		* purple_network_listen_map_external
 		* purple_network_listen_range_family. Use purple_network_listen,
--- a/libpurple/util.c	Wed Apr 25 15:30:53 2018 -0500
+++ b/libpurple/util.c	Fri Jul 14 15:18:08 2017 -0500
@@ -476,53 +476,6 @@
  * Date/Time Functions
  **************************************************************************/
 
-const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso)
-{
-	static char buf[7];
-	long off;
-	gint8 min;
-	gint8 hrs;
-	struct tm new_tm = *tm;
-
-	mktime(&new_tm);
-
-	if (new_tm.tm_isdst < 0)
-		g_return_val_if_reached("");
-
-#ifdef _WIN32
-	if ((off = wpurple_get_tz_offset()) == -1)
-		return "";
-#elif defined(HAVE_TM_GMTOFF)
-	off = new_tm.tm_gmtoff;
-#elif defined(HAVE_TIMEZONE)
-	tzset();
-	off = -1 * timezone;
-#else
-	purple_debug_warning("util",
-		"there is no possibility to obtain tz offset");
-	return "";
-#endif
-
-	min = (off / 60) % 60;
-	hrs = ((off / 60) - min) / 60;
-
-	if(iso) {
-		if (0 == off) {
-			strcpy(buf, "Z");
-		} else {
-			/* please leave the colons...they're optional for iso, but jabber
-			 * wants them */
-			if(g_snprintf(buf, sizeof(buf), "%+03d:%02d", hrs, ABS(min)) > 6)
-				g_return_val_if_reached("");
-		}
-	} else {
-		if (g_snprintf(buf, sizeof(buf), "%+03d%02d", hrs, ABS(min)) > 5)
-			g_return_val_if_reached("");
-	}
-
-	return buf;
-}
-
 const char *
 purple_utf8_strftime(const char *format, const struct tm *tm)
 {
--- a/libpurple/util.h	Wed Apr 25 15:30:53 2018 -0500
+++ b/libpurple/util.h	Fri Jul 14 15:18:08 2017 -0500
@@ -367,17 +367,6 @@
 const char *purple_utf8_strftime(const char *format, const struct tm *tm);
 
 /**
- * purple_get_tzoff_str:
- * @tm:   The time to get the timezone for
- * @iso:  TRUE to format the offset according to ISO-8601, FALSE to
- *             not substitute 'Z' for 0 offset, and to not separate
- *             hours and minutes with a colon.
- *
- * Gets a string representation of the local timezone offset
- */
-const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso);
-
-/**
  * purple_date_format_short:
  * @tm: The time to format, or %NULL to use the current local time
  *

mercurial