380 |
{ |
{ |
381 |
time_t current; |
time_t current; |
382 |
struct tm *timestruct = NULL; |
struct tm *timestruct = NULL; |
383 |
gchar sdatenow[20]; |
gchar datenow[20], *date; |
384 |
|
GError *error; |
385 |
|
|
386 |
time (¤t); |
time (¤t); |
387 |
timestruct = localtime (¤t); |
timestruct = localtime (¤t); |
388 |
strftime (sdatenow, 20, "%d %b %Y", timestruct); |
strftime (datenow, 20, "%d %b %Y", timestruct); |
389 |
return (g_strdup (sdatenow)); |
|
390 |
|
if (!g_utf8_validate (datenow, -1, NULL )) |
391 |
|
{ |
392 |
|
date = g_locale_to_utf8 (datenow, -1, NULL, NULL, &error); |
393 |
|
if (!date) |
394 |
|
{ |
395 |
|
g_print (_("Unable to convert '%s' to UTF-8: %s"), datenow, |
396 |
|
error->message); |
397 |
|
g_error_free (error); |
398 |
|
} |
399 |
|
} |
400 |
|
else date = g_strdup (datenow); |
401 |
|
|
402 |
|
return (date); |
403 |
} |
} |
404 |
|
|
405 |
/* get the current time, returned value has to be freed */ |
/* get the current time, returned value has to be freed */ |