}
}
ret = GNUNET_malloc (32);
- GNUNET_snprintf (ret, 32, "%llu%s", size, unit);
+ GNUNET_snprintf (ret, 32, "%llu %s", size, unit);
return ret;
}
tmp = GNUNET_malloc (tmpSize);
itmp = tmp;
finSize = tmpSize;
- if (iconv (cd,
-#if FREEBSD
- (const char **) &input,
+ if (iconv (cd,
+#if FREEBSD || DARWIN
+ (const char **) &input,
#else
- (char **) &input,
+ (char **) &input,
#endif
- &len, &itmp, &finSize) == (size_t) - 1)
+ &len, &itmp, &finSize) == (size_t) - 1)
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "iconv");
iconv_close (cd);
/**
* Give relative time in human-readable fancy format.
*
- * @param del time in milli seconds
+ * @param delta time in milli seconds
* @return time as human-readable string
*/
char *
-GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative del)
+GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta)
{
const char *unit = _( /* time unit */ "ms");
char *ret;
- uint64_t delta = del.value;
+ uint64_t dval = delta.value;
- if (delta > 5 * 1000)
+ if (delta.value == GNUNET_TIME_UNIT_FOREVER_REL.value)
+ return GNUNET_strdup (_("eternity"));
+ if (dval > 5 * 1000)
{
- delta = delta / 1000;
+ dval = dval / 1000;
unit = _( /* time unit */ "s");
- if (delta > 5 * 60)
+ if (dval > 5 * 60)
{
- delta = delta / 60;
+ dval = dval / 60;
unit = _( /* time unit */ "m");
- if (delta > 5 * 60)
+ if (dval > 5 * 60)
{
- delta = delta / 60;
+ dval = dval / 60;
unit = _( /* time unit */ "h");
- if (delta > 5 * 24)
+ if (dval > 5 * 24)
{
- delta = delta / 24;
+ dval = dval / 24;
unit = _( /* time unit */ " days");
}
}
}
}
- GNUNET_asprintf (&ret, "%llu%s", delta, unit);
+ GNUNET_asprintf (&ret, "%llu %s", dval, unit);
return ret;
}
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));