r18812 - gnucash/trunk/src/libqof/qof - MSVC compatibility: strftime() doesn't know "%T" here. Also, g_fopen doesn't work, but fopen does.

Christian Stimming cstim at code.gnucash.org
Thu Mar 4 12:47:28 EST 2010


Author: cstim
Date: 2010-03-04 12:47:28 -0500 (Thu, 04 Mar 2010)
New Revision: 18812
Trac: http://svn.gnucash.org/trac/changeset/18812

Modified:
   gnucash/trunk/src/libqof/qof/qoflog.c
Log:
MSVC compatibility: strftime() doesn't know "%T" here. Also, g_fopen doesn't work, but fopen does.

Modified: gnucash/trunk/src/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qoflog.c	2010-03-04 16:32:54 UTC (rev 18811)
+++ gnucash/trunk/src/libqof/qof/qoflog.c	2010-03-04 17:47:28 UTC (rev 18812)
@@ -116,10 +116,17 @@
         char timestamp_buf[10];
         time_t now;
         struct tm now_tm;
+        const char *format_24hour =
+#ifdef _MSC_VER
+            "%H:%M:%S"
+#else
+            "%T"
+#endif
+            ;
         gchar *level_str = qof_log_level_to_string(log_level);
         now = time(NULL);
         localtime_r(&now, &now_tm);
-        qof_strftime(timestamp_buf, 9, "%T", &now_tm);
+        qof_strftime(timestamp_buf, 9, format_24hour, &now_tm);
 
         fprintf(fout, "* %s %*s <%s> %*s%s%s",
                 timestamp_buf,
@@ -162,7 +169,7 @@
 #ifdef _MSC_VER
             /* MSVC compiler: Somehow the OS thinks file descriptor from above
              * still isn't open. So we open normally with the file name and that's it. */
-            fout = g_fopen(fname, "wb");
+            fout = fopen(fname, "wb");
 #else
             g_rename(fname, log_filename);
             fout = fdopen(fd, "w");



More information about the gnucash-changes mailing list