Convert all time_t to time64: optional & plugins

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22628 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2012-12-01 22:46:08 +00:00
parent 1cbd2d761b
commit d17e41e886
2 changed files with 10 additions and 19 deletions

View File

@ -200,7 +200,7 @@ public:
// void set_date_entered(const Glib::DateTime& t) { xaccTransSetDateEnteredSecs(gobj(), t.toTime_t()); } // void set_date_entered(const Glib::DateTime& t) { xaccTransSetDateEnteredSecs(gobj(), t.toTime_t()); }
time_t get_date_entered_tt() const time_t get_date_entered_tt() const
{ {
return timespecToTime_t(xaccTransRetDateEnteredTS(gobj())); return timespecToTime64 (xaccTransRetDateEnteredTS(gobj()));
} }
//Glib::DateTime get_date_entered() const { return toGDateTime(xaccTransRetDateEnteredTS(gobj())); } //Glib::DateTime get_date_entered() const { return toGDateTime(xaccTransRetDateEnteredTS(gobj())); }

View File

@ -34,10 +34,6 @@
#include "config.h" #include "config.h"
#endif #endif
#ifndef HAVE_LOCALTIME_R
#include "localtime_r.h"
#endif
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <regex.h> #include <regex.h>
#include <glib.h> #include <glib.h>
@ -60,6 +56,7 @@
#include "gncIDSearch.h" #include "gncIDSearch.h"
#include "dialog-bi-import.h" #include "dialog-bi-import.h"
#include "dialog-bi-import-helper.h" #include "dialog-bi-import-helper.h"
#include <gnc-gdate-utils.h>
// To open the invoices for editing // To open the invoices for editing
#include "business/business-gnome/gnc-plugin-page-invoice.h" #include "business/business-gnome/gnc-plugin-page-invoice.h"
@ -329,19 +326,13 @@ gnc_bi_import_fix_bis (GtkListStore * store, guint * fixed, guint * deleted,
{ {
if (prev_date_opened->len == 0) if (prev_date_opened->len == 0)
{ {
// fix this by using the current date (why is this so complicated?) // fix this by using the current date
gchar temp[20]; gchar temp[20];
GDate *date; GDate date;
time_t secs; g_date_clear (&date, 1);
struct tm now; gnc_gdate_set_today (&date);
time (&secs); g_date_strftime (temp, 20, "%x", &date); // create a locale specific date string
localtime_r (&secs, &now);
date =
g_date_new_dmy (now.tm_mday, now.tm_mon + 1,
now.tm_year + 1900);
g_date_strftime (temp, 20, "%x", date); // create a locale specific date string
g_string_assign (prev_date_opened, temp); g_string_assign (prev_date_opened, temp);
g_date_free (date);
} }
// fix this by using the previous date_opened value (multi line invoice) // fix this by using the previous date_opened value (multi line invoice)
gtk_list_store_set (store, &iter, DATE_OPENED, gtk_list_store_set (store, &iter, DATE_OPENED,
@ -589,9 +580,9 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
} }
else // If no date in CSV else // If no date in CSV
{ {
time_t now = time (NULL); time64 now = gnc_time (NULL);
Timespec now_timespec; Timespec now_timespec;
timespecFromTime_t (&now_timespec, now); timespecFromTime64 (&now_timespec, now);
gncInvoiceSetDateOpened (invoice, now_timespec); gncInvoiceSetDateOpened (invoice, now_timespec);
} }
gncInvoiceSetBillingID (invoice, billing_id ? billing_id : ""); gncInvoiceSetBillingID (invoice, billing_id ? billing_id : "");
@ -672,7 +663,7 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
gncEntrySetDateGDate (entry, date); gncEntrySetDateGDate (entry, date);
g_date_free (date); g_date_free (date);
} }
timespecFromTime_t (&today, time (NULL)); // set today to the current date timespecFromTime64 (&today, gnc_time (NULL)); // set today to the current date
gncEntrySetDateEntered (entry, today); gncEntrySetDateEntered (entry, today);
gncEntrySetDescription (entry, desc); gncEntrySetDescription (entry, desc);
gncEntrySetAction (entry, action); gncEntrySetAction (entry, action);