stuff
[oweals/gnunet.git] / src / util / strings.c
index d53bcd4826d43f43c31c46e3a37af33737993509..6a7b9150be8415f82f22a1c90ff1358629822a3f 100644 (file)
@@ -159,7 +159,7 @@ GNUNET_STRINGS_byte_size_fancy (unsigned long long size)
         }
     }
   ret = GNUNET_malloc (32);
-  GNUNET_snprintf (ret, 32, "%llu%s", size, unit);
+  GNUNET_snprintf (ret, 32, "%llu %s", size, unit);
   return ret;
 }
 
@@ -199,7 +199,7 @@ GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset)
   itmp = tmp;
   finSize = tmpSize;
   if (iconv (cd,
-#if FREEBSD
+#if FREEBSD || DARWIN
              (const char **) &input,
 #else
              (char **) &input,
@@ -363,6 +363,8 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta)
   char *ret;
   uint64_t dval = delta.value;
 
+  if (delta.value == GNUNET_TIME_UNIT_FOREVER_REL.value)
+    return GNUNET_strdup (_("eternity"));
   if (dval > 5 * 1000)
     {
       dval = dval / 1000;
@@ -383,7 +385,7 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta)
             }
         }
     }
-  GNUNET_asprintf (&ret, "%llu%s", dval, unit);
+  GNUNET_asprintf (&ret, "%llu %s", dval, unit);
   return ret;
 }
 
@@ -401,6 +403,8 @@ GNUNET_STRINGS_absolute_time_to_string (struct GNUNET_TIME_Absolute t)
   time_t tt;
   char *ret;
 
+  if (t.value == GNUNET_TIME_UNIT_FOREVER_ABS.value)
+    return GNUNET_strdup (_("end of time"));
   tt = t.value / 1000;
 #ifdef ctime_r
   ret = ctime_r (&tt, GNUNET_malloc (32));