r22618 - gnucash/trunk/src/core-utils - Convert all time_t to time64: core-utils

John Ralls jralls at code.gnucash.org
Sat Dec 1 17:44:22 EST 2012


Author: jralls
Date: 2012-12-01 17:44:22 -0500 (Sat, 01 Dec 2012)
New Revision: 22618
Trac: http://svn.gnucash.org/trac/changeset/22618

Modified:
   gnucash/trunk/src/core-utils/gnc-gdate-utils.c
   gnucash/trunk/src/core-utils/gnc-gdate-utils.h
   gnucash/trunk/src/core-utils/gnc-jalali.c
Log:
Convert all time_t to time64: core-utils

Modified: gnucash/trunk/src/core-utils/gnc-gdate-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gdate-utils.c	2012-12-01 22:44:13 UTC (rev 22617)
+++ gnucash/trunk/src/core-utils/gnc-gdate-utils.c	2012-12-01 22:44:22 UTC (rev 22618)
@@ -23,7 +23,6 @@
 
 #include "config.h"
 #include <glib.h>
-#include <gnc-date.h>
 
 #include "gnc-gdate-utils.h"
 
@@ -63,25 +62,25 @@
 }
 
 
-time_t
-gnc_timet_get_day_start_gdate (GDate *date)
+time64
+gnc_time64_get_day_start_gdate (const GDate *date)
 {
     struct tm stm;
-    time_t secs;
+    time64 secs;
 
     /* First convert to a 'struct tm' */
-    g_date_to_struct_tm(date, &stm);
+    g_date_to_struct_tm (date, &stm);
 
     /* Then convert to number of seconds */
-    secs = mktime (&stm);
+    secs = gnc_mktime (&stm);
     return secs;
 }
 
-time_t
-gnc_timet_get_day_end_gdate (GDate *date)
+time64
+gnc_time64_get_day_end_gdate (const GDate *date)
 {
     struct tm stm;
-    time_t secs;
+    time64 secs;
 
     /* First convert to a 'struct tm' */
     g_date_to_struct_tm(date, &stm);
@@ -93,7 +92,7 @@
     stm.tm_isdst = -1;
 
     /* Then convert to number of seconds */
-    secs = mktime (&stm);
+    secs = gnc_mktime (&stm);
     return secs;
 }
 

Modified: gnucash/trunk/src/core-utils/gnc-gdate-utils.h
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gdate-utils.h	2012-12-01 22:44:13 UTC (rev 22617)
+++ gnucash/trunk/src/core-utils/gnc-gdate-utils.h	2012-12-01 22:44:22 UTC (rev 22618)
@@ -38,7 +38,23 @@
 #ifndef GNC_GDATE_UTILS_H
 #define GNC_GDATE_UTILS_H
 
+#include <gnc-date.h>
 
+/** @name GDate time64 setters
+    @{ */
+/** Set a GDate to the current day
+ * @param theGDate: The date to act on
+ */
+void gnc_gdate_set_today (GDate* gd);
+
+/** Set a GDate to a time64
+ * @param theGDate: the date to act on
+ * @param time: the time to set it to.
+ */
+void gnc_gdate_set_time64 (GDate* gd, time64 time);
+
+/** @} */
+
 /** @name GDate hash table support
     @{ */
 
@@ -53,18 +69,18 @@
 
 /** @} */
 
-/** @name GDate to time_t conversions
+/** @name GDate to time64 conversions
     @{ */
 
-/** The gnc_timet_get_day_start() routine will take the given time in
+/** The gnc_time64_get_day_start() routine will take the given time in
  *  GLib GDate format and adjust it to the first second of that day.
  */
-time_t gnc_timet_get_day_start_gdate (GDate *date);
+time64 gnc_time64_get_day_start_gdate (const GDate *date);
 
-/** The gnc_timet_get_day_end() routine will take the given time in
+/** The gnc_time64_get_day_end() routine will take the given time in
  *  GLib GDate format and adjust it to the last second of that day.
  */
-time_t gnc_timet_get_day_end_gdate (GDate *date);
+time64 gnc_time64_get_day_end_gdate (const GDate *date);
 
 /** @} */
 

Modified: gnucash/trunk/src/core-utils/gnc-jalali.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-jalali.c	2012-12-01 22:44:13 UTC (rev 22617)
+++ gnucash/trunk/src/core-utils/gnc-jalali.c	2012-12-01 22:44:22 UTC (rev 22618)
@@ -42,7 +42,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <time.h>
 #include <glib.h>
 
 int g_days_in_month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
@@ -179,11 +178,11 @@
 main(void)
 {
     int y, m, d;
-    time_t bin_time;
+    time64 bin_time;
     struct tm *br_time;
 
-    time(&bin_time);
-    br_time = localtime(&bin_time);
+    gnc_time (&bin_time);
+    br_time = gnc_localtime (&bin_time);
 
     gregorian_to_jalali(&y, &m, &d,
                         1900 + br_time->tm_year,



More information about the gnucash-changes mailing list