-
-
-/* just to prevent warnings:
- * warning: `%x' yields only last 2 digits of year in some locales
- */
-static size_t
-my_strftime(char *s, size_t max, const char *fmt, const
- struct tm *tm) {
- return strftime(s, max, fmt, tm);
-}
-
-
-
-/* not reentrant/thread-safe */
-const gchar*
-display_date (time_t date)
-{
- struct tm date_tm, now_tm;
- time_t now;
-
- const gint buf_size = 64;
- static gchar date_buf[64]; /* buf_size is not ... */
- static gchar now_buf[64]; /* ...const enough... */
-
- now = time (NULL);
-
- localtime_r(&now, &now_tm);
- localtime_r(&date, &date_tm);
-
- /* get today's date */
- my_strftime (date_buf, buf_size, "%x", &date_tm);
- my_strftime (now_buf, buf_size, "%x", &now_tm); /* today */
-
- /* if this is today, get the time instead of the date */
- if (strcmp (date_buf, now_buf) == 0)
- strftime (date_buf, buf_size, _("%X"), &date_tm);
-
- return date_buf;
-}
-
-