Revision: 1910
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1910&view=rev
Author:   mow
Date:     2010-02-27 20:34:54 +0000 (Sat, 27 Feb 2010)

Log Message:
-----------
Unifying the datetime output

The output of %date% and %formatted.DateTime% should be equivalent.

Modified Paths:
--------------
    trunk/src/exif-common.c
    trunk/src/filedata.c

Modified: trunk/src/exif-common.c
===================================================================
--- trunk/src/exif-common.c     2010-02-17 21:19:22 UTC (rev 1909)
+++ trunk/src/exif-common.c     2010-02-27 20:34:54 UTC (rev 1910)
@@ -9,6 +9,8 @@
 #  include "config.h"
 #endif
 
+#define _XOPEN_SOURCE
+
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
@@ -188,6 +190,11 @@
 {
        gchar *text = exif_get_data_as_text(exif, 
"Exif.Photo.DateTimeOriginal");
        gchar *subsec = NULL;
+       gchar buf[128];
+       gchar *tmp;
+       gint buflen;
+       struct tm tm;
+       GError *error = NULL;
 
        if (text)
                {
@@ -198,9 +205,30 @@
                text = exif_get_data_as_text(exif, "Exif.Image.DateTime");
                if (text) subsec = exif_get_data_as_text(exif, 
"Exif.Photo.SubSecTime");
                }
+
+       /* Convert the stuff into a tm struct */
+       if (text && strptime(text, "%Y:%m:%d %H:%M:%S", &tm))
+               {
+               buflen = strftime(buf, sizeof(buf), "%x %X", &tm);
+               if (buflen > 0)
+                       {
+                       tmp = g_locale_to_utf8(buf, buflen, NULL, NULL, &error);
+                       if (error)
+                               {
+                               log_printf("Error converting locale strftime to 
UTF-8: %s\n", error->message);
+                               g_error_free(error);
+                               }
+                       else
+                               {
+                               g_free(text);
+                               text = g_strdup(tmp);
+                               }
+                       }
+               }
+
        if (subsec)
                {
-               gchar *tmp = text;
+               tmp = text;
                text = g_strconcat(tmp, ".", subsec, NULL);
                g_free(tmp);
                g_free(subsec);

Modified: trunk/src/filedata.c
===================================================================
--- trunk/src/filedata.c        2010-02-17 21:19:22 UTC (rev 1909)
+++ trunk/src/filedata.c        2010-02-27 20:34:54 UTC (rev 1910)
@@ -116,7 +116,7 @@
        btime = localtime(&t);
 
        /* the %x warning about 2 digit years is not an error */
-       buflen = strftime(buf, sizeof(buf), "%x %H:%M", btime);
+       buflen = strftime(buf, sizeof(buf), "%x %X", btime);
        if (buflen < 1) return "";
 
        g_free(ret);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to