g_strdup_strftime



I'd like to see a function named g_strdup_strftime added to <glib.h>. With
glibc, it's trivial to implement:

    gchar *
    g_strdup_strftime (const gchar *format, const struct tm *time)
      {
        size_t size;
        gchar *result;

        size = strftime (NULL, UINT_MAX, format, time);
        result = g_malloc (size + 1);
        strftime (result, size + 1, format, time);
        return result;
      }

But it might be trickier to do with non-Gnu versions of strftime.

What do you all think?

    -- Darin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]