Convert all time_t to time64: gnome-utils and gnome-search

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22625 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2012-12-01 22:45:34 +00:00
parent d6f8fe4f5c
commit bfdc22959a
25 changed files with 157 additions and 233 deletions

View File

@ -113,7 +113,7 @@ gnc_search_date_class_init (GNCSearchDateClass *class)
static void static void
gnc_search_date_init (GNCSearchDate *o) gnc_search_date_init (GNCSearchDate *o)
{ {
o->ts.tv_sec = time(NULL); o->ts.tv_sec = gnc_time (NULL);
o->how = QOF_COMPARE_LT; o->how = QOF_COMPARE_LT;
} }

View File

@ -281,7 +281,7 @@ gnc_account_create_transfer_balance (QofBook *book,
Account *account, Account *account,
Account *transfer, Account *transfer,
gnc_numeric balance, gnc_numeric balance,
time_t date) time64 date)
{ {
Transaction *trans; Transaction *trans;
Split *split; Split *split;
@ -341,7 +341,7 @@ gnc_ui_to_account(AccountWindow *aw)
gboolean flag; gboolean flag;
gnc_numeric balance; gnc_numeric balance;
gboolean use_equity, nonstd; gboolean use_equity, nonstd;
time_t date; time64 date;
gint index, old_scu, new_scu; gint index, old_scu, new_scu;
GtkTextIter start, end; GtkTextIter start, end;
@ -1373,7 +1373,7 @@ gnc_account_window_create(AccountWindow *aw)
gtk_label_set_mnemonic_widget (GTK_LABEL(label), amount); gtk_label_set_mnemonic_widget (GTK_LABEL(label), amount);
box = GTK_WIDGET(gtk_builder_get_object (builder, "opening_balance_date_box")); box = GTK_WIDGET(gtk_builder_get_object (builder, "opening_balance_date_box"));
date_edit = gnc_date_edit_new (time (NULL), 1, 1); date_edit = gnc_date_edit_new (gnc_time (NULL), 1, 1);
aw->opening_balance_date_edit = date_edit; aw->opening_balance_date_edit = date_edit;
gtk_box_pack_start(GTK_BOX(box), date_edit, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), date_edit, TRUE, TRUE, 0);
gtk_widget_show (date_edit); gtk_widget_show (date_edit);

View File

@ -62,7 +62,7 @@ struct CloseBookWindow
GtkWidget* desc_widget; GtkWidget* desc_widget;
/* The final settings */ /* The final settings */
time_t close_date; time64 close_date;
const char* desc; const char* desc;
/* Component registration */ /* Component registration */
@ -101,7 +101,7 @@ find_or_create_txn(struct CloseAccountsCB* cacb, gnc_commodity* cmdty)
txn->total = gnc_numeric_zero(); txn->total = gnc_numeric_zero();
txn->txn = xaccMallocTransaction(cacb->cbw->book); txn->txn = xaccMallocTransaction(cacb->cbw->book);
xaccTransBeginEdit(txn->txn); xaccTransBeginEdit(txn->txn);
xaccTransSetDateEnteredSecs(txn->txn, time(NULL)); xaccTransSetDateEnteredSecs(txn->txn, gnc_time (NULL));
xaccTransSetDatePostedSecs(txn->txn, cacb->cbw->close_date); xaccTransSetDatePostedSecs(txn->txn, cacb->cbw->close_date);
xaccTransSetDescription(txn->txn, cacb->cbw->desc); xaccTransSetDescription(txn->txn, cacb->cbw->desc);
xaccTransSetCurrency(txn->txn, cmdty); xaccTransSetCurrency(txn->txn, cmdty);
@ -336,7 +336,7 @@ void gnc_ui_close_book (QofBook* book)
/* close date */ /* close date */
box = GTK_WIDGET(gtk_builder_get_object (builder, "date_box")); box = GTK_WIDGET(gtk_builder_get_object (builder, "date_box"));
cbw->close_date_widget = gnc_date_edit_new(time(NULL), FALSE, FALSE); cbw->close_date_widget = gnc_date_edit_new(gnc_time (NULL), FALSE, FALSE);
gtk_box_pack_start(GTK_BOX(box), cbw->close_date_widget, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(box), cbw->close_date_widget, TRUE, TRUE, 0);
/* income acct */ /* income acct */

View File

@ -91,7 +91,7 @@ gnc_dup_trans_output_cb(GtkSpinButton *spinbutton,
static void static void
gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog, gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
time_t date, const char *num_str) time64 date, const char *num_str)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkBuilder *builder; GtkBuilder *builder;
@ -153,7 +153,7 @@ gnc_dup_trans_dialog_create (GtkWidget * parent, DupTransDialog *dt_dialog,
static gboolean static gboolean
gnc_dup_trans_dialog_internal (GtkWidget * parent, const char* title, gnc_dup_trans_dialog_internal (GtkWidget * parent, const char* title,
time_t *date_p, GDate *gdate_p, time64 *date_p, GDate *gdate_p,
const char *num, char **out_num) const char *num, char **out_num)
{ {
DupTransDialog *dt_dialog; DupTransDialog *dt_dialog;
@ -210,7 +210,7 @@ gnc_dup_trans_dialog_internal (GtkWidget * parent, const char* title,
} }
gboolean gboolean
gnc_dup_trans_dialog (GtkWidget * parent, time_t *date_p, gnc_dup_trans_dialog (GtkWidget * parent, time64 *date_p,
const char *num, char **out_num) const char *num, char **out_num)
{ {
return gnc_dup_trans_dialog_internal(parent, NULL, date_p, NULL, num, out_num); return gnc_dup_trans_dialog_internal(parent, NULL, date_p, NULL, num, out_num);
@ -220,19 +220,19 @@ gboolean
gnc_dup_trans_dialog_gdate (GtkWidget * parent, GDate *gdate_p, gnc_dup_trans_dialog_gdate (GtkWidget * parent, GDate *gdate_p,
const char *num, char **out_num) const char *num, char **out_num)
{ {
time_t tmp_time; time64 tmp_time;
g_assert(gdate_p); g_assert(gdate_p);
tmp_time = timespecToTime_t(gdate_to_timespec(*gdate_p)); tmp_time = timespecToTime64(gdate_to_timespec(*gdate_p));
return gnc_dup_trans_dialog_internal(parent, NULL, &tmp_time, gdate_p, num, out_num); return gnc_dup_trans_dialog_internal(parent, NULL, &tmp_time, gdate_p, num, out_num);
} }
gboolean gboolean
gnc_dup_date_dialog (GtkWidget * parent, const char* title, GDate *gdate_p) gnc_dup_date_dialog (GtkWidget * parent, const char* title, GDate *gdate_p)
{ {
time_t tmp_time; time64 tmp_time;
g_assert(gdate_p); g_assert(gdate_p);
tmp_time = timespecToTime_t(gdate_to_timespec(*gdate_p)); tmp_time = timespecToTime64(gdate_to_timespec(*gdate_p));
return gnc_dup_trans_dialog_internal(parent, title, &tmp_time, gdate_p, NULL, NULL); return gnc_dup_trans_dialog_internal(parent, title, &tmp_time, gdate_p, NULL, NULL);
} }

View File

@ -28,6 +28,7 @@
#define DIALOGDUPTRANS_H #define DIALOGDUPTRANS_H
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gnc-date.h>
/********************************************************************\ /********************************************************************\
@ -42,7 +43,7 @@
* Return: TRUE if user closes dialog with 'OK' * * Return: TRUE if user closes dialog with 'OK' *
\********************************************************************/ \********************************************************************/
gboolean gboolean
gnc_dup_trans_dialog (GtkWidget * parent, time_t *date_p, gnc_dup_trans_dialog (GtkWidget * parent, time64 *date_p,
const char *num, char **out_num); const char *num, char **out_num);
gboolean gboolean

View File

@ -1309,7 +1309,7 @@ gnc_prefs_date_edit_user_cb (GNCDateEdit *gde,
gpointer user_data) gpointer user_data)
{ {
const gchar *name; const gchar *name;
time_t time; time64 time;
g_return_if_fail(GNC_IS_DATE_EDIT(gde)); g_return_if_fail(GNC_IS_DATE_EDIT(gde));
name = g_object_get_data(G_OBJECT(gde), "name"); name = g_object_get_data(G_OBJECT(gde), "name");
@ -1333,7 +1333,7 @@ static void
gnc_prefs_date_edit_gconf_cb (GNCDateEdit *gde, gnc_prefs_date_edit_gconf_cb (GNCDateEdit *gde,
GConfEntry *entry) GConfEntry *entry)
{ {
time_t time; time64 time;
g_return_if_fail(GNC_IS_DATE_EDIT(gde)); g_return_if_fail(GNC_IS_DATE_EDIT(gde));
ENTER("date_edit %p, entry %p", gde, entry); ENTER("date_edit %p, entry %p", gde, entry);
@ -1360,7 +1360,7 @@ static void
gnc_prefs_connect_date_edit (GNCDateEdit *gde , const gchar *boxname ) gnc_prefs_connect_date_edit (GNCDateEdit *gde , const gchar *boxname )
{ {
const gchar *name; const gchar *name;
time_t time; time64 time;
g_return_if_fail(GNC_IS_DATE_EDIT(gde)); g_return_if_fail(GNC_IS_DATE_EDIT(gde));
@ -1566,7 +1566,7 @@ gnc_preferences_dialog_create(void)
gtk_box_pack_start (GTK_BOX (box), period, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), period, TRUE, TRUE, 0);
box = GTK_WIDGET(gtk_builder_get_object (builder, "gconf/window/pages/account_tree/summary/start_date")); box = GTK_WIDGET(gtk_builder_get_object (builder, "gconf/window/pages/account_tree/summary/start_date"));
date = gnc_date_edit_new(time(NULL), FALSE, FALSE); date = gnc_date_edit_new(gnc_time (NULL), FALSE, FALSE);
gtk_widget_show (date); gtk_widget_show (date);
gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0);
@ -1576,7 +1576,7 @@ gnc_preferences_dialog_create(void)
gtk_box_pack_start (GTK_BOX (box), period, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), period, TRUE, TRUE, 0);
box = GTK_WIDGET(gtk_builder_get_object (builder, "gconf/window/pages/account_tree/summary/end_date")); box = GTK_WIDGET(gtk_builder_get_object (builder, "gconf/window/pages/account_tree/summary/end_date"));
date = gnc_date_edit_new(time(NULL), FALSE, FALSE); date = gnc_date_edit_new(gnc_time (NULL), FALSE, FALSE);
gtk_widget_show (date); gtk_widget_show (date);
gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0);

View File

@ -1278,7 +1278,7 @@ gnc_xfer_dialog_set_num(XferDialog *xferData, const char *num)
* Return: none * * Return: none *
\********************************************************************/ \********************************************************************/
void void
gnc_xfer_dialog_set_date(XferDialog *xferData, time_t set_date) gnc_xfer_dialog_set_date(XferDialog *xferData, time64 set_date)
{ {
if (xferData == NULL) if (xferData == NULL)
return; return;

View File

@ -136,7 +136,7 @@ void gnc_xfer_dialog_set_num(XferDialog *xferData, const char *num);
* set_date - the date to set * set_date - the date to set
* Return: none * Return: none
*/ */
void gnc_xfer_dialog_set_date(XferDialog *xferData, time_t set_time); void gnc_xfer_dialog_set_date(XferDialog *xferData, time64 set_time);
/** Set the exchange rate. If exchange-rate is 0, then do nothing */ /** Set the exchange rate. If exchange-rate is 0, then do nothing */
void gnc_xfer_dialog_set_exchange_rate(XferDialog *xferData, void gnc_xfer_dialog_set_exchange_rate(XferDialog *xferData,

View File

@ -40,6 +40,7 @@
#include "gnc-euro.h" #include "gnc-euro.h"
#include "gnc-ui-util.h" #include "gnc-ui-util.h"
#include "gnc-gconf-utils.h" #include "gnc-gconf-utils.h"
#include <gnc-gdate-utils.h>
/* This static indicates the debugging module that this .o belongs to. */ /* This static indicates the debugging module that this .o belongs to. */
static QofLogModule log_module = GNC_MOD_GUI; static QofLogModule log_module = GNC_MOD_GUI;
@ -412,14 +413,9 @@ gnc_handle_date_accelerator (GdkEventKey *event,
case GDK_T: case GDK_T:
case GDK_t: case GDK_t:
{
/* today */ /* today */
GTime gtime; gnc_gdate_set_today (&gdate);
gtime = time (NULL);
g_date_set_time_t (&gdate, gtime);
break; break;
}
default: default:
return FALSE; return FALSE;

View File

@ -91,12 +91,12 @@ static void gcrd_hide (GncCellRendererPopup *cell);
/* These two functions are used internally */ /* These two functions are used internally */
gboolean gcrd_time2dmy ( time_t raw_time, gint *day, gint *month, gint *year); gboolean gcrd_time2dmy ( time64 raw_time, gint *day, gint *month, gint *year);
static time_t gcrd_dmy2time ( gint day, gint month, gint year); static time64 gcrd_dmy2time ( gint day, gint month, gint year);
/* These two functions convert string to date to string */ /* These two functions convert string to date to string */
static gchar * gcrd_time2dmy_string ( time_t raw_time); static gchar * gcrd_time2dmy_string ( time64 raw_time);
static time_t gcrd_string_dmy2time ( char *date_string); static time64 gcrd_string_dmy2time ( char *date_string);
static GncCellRendererPopupClass *parent_class; static GncCellRendererPopupClass *parent_class;
@ -181,7 +181,7 @@ gcrd_init (GncCellRendererDate *date)
date); date);
//Set calendar to show current date when displayed //Set calendar to show current date when displayed
date->time = time(NULL); date->time = gnc_time (NULL);
gtk_widget_show_all (frame); gtk_widget_show_all (frame);
} }
@ -324,7 +324,7 @@ gcrd_show (GncCellRendererPopup *cell,
if (!(g_strcmp0(cell->cell_text, ""))) if (!(g_strcmp0(cell->cell_text, "")))
{ {
date->time = time(NULL); date->time = gnc_time (NULL);
gcrd_time2dmy ( date->time, &day, &month, &year); gcrd_time2dmy ( date->time, &day, &month, &year);
} }
else else
@ -356,10 +356,10 @@ gnc_cell_renderer_date_new (gboolean use_buttons)
static void static void
gcrd_today_clicked (GtkWidget *button, GncCellRendererDate *cell) gcrd_today_clicked (GtkWidget *button, GncCellRendererDate *cell)
{ {
time_t today; time64 today;
gint year, month, day; gint year, month, day;
today = time(NULL); today = gnc_time (NULL);
gcrd_time2dmy ( today, &day, &month, &year); gcrd_time2dmy ( today, &day, &month, &year);
@ -409,7 +409,7 @@ gcrd_day_selected (GtkWidget *popup_window, GncCellRendererDate *cell)
guint year; guint year;
guint month; guint month;
guint day; guint day;
time_t t; time64 t;
gchar *str; gchar *str;
gtk_calendar_get_date (GTK_CALENDAR (cell->calendar), gtk_calendar_get_date (GTK_CALENDAR (cell->calendar),
@ -450,72 +450,63 @@ gcrd_grab_on_window (GdkWindow *window,
} }
/* This function converts a time_t value date to separate entities */ /* This function converts a time64 value date to separate entities */
gboolean gboolean
gcrd_time2dmy ( time_t raw_time, gint *day, gint *month, gint *year) gcrd_time2dmy ( time64 raw_time, gint *day, gint *month, gint *year)
{ {
struct tm * timeinfo; struct tm * timeinfo;
timeinfo = localtime ( &raw_time ); timeinfo = gnc_localtime (&raw_time);
*day = timeinfo->tm_mday; *day = timeinfo->tm_mday;
*month = timeinfo->tm_mon + 1; *month = timeinfo->tm_mon + 1;
*year = timeinfo->tm_year + 1900; *year = timeinfo->tm_year + 1900;
gnc_tm_free (timeinfo);
return TRUE; return TRUE;
} }
/* This function converts separate entities to a time_t value */ /* This function converts separate entities to a time64 value */
static time_t static time64
gcrd_dmy2time ( gint day, gint month, gint year) gcrd_dmy2time ( gint day, gint month, gint year)
{ {
struct tm *when; struct tm when;
time_t raw_time; memset (&when, 0, sizeof (when));
when.tm_year = year - 1900;
when.tm_mon = month - 1 ;
when.tm_mday = day;
time(&raw_time); return gnc_mktime (&when);
when = localtime ( &raw_time );
when->tm_year = year - 1900;
when->tm_mon = month - 1 ;
when->tm_mday = day;
return mktime(when);
} }
/* This function converts a time_t value date to a string */ /* This function converts a time64 value date to a string */
static gchar * static gchar *
gcrd_time2dmy_string ( time_t raw_time) gcrd_time2dmy_string ( time64 raw_time)
{ {
return qof_print_date (raw_time); return qof_print_date (raw_time);
} }
/* This function converts a string date to a time_t value */ /* This function converts a string date to a time64 value */
static time_t static time64
gcrd_string_dmy2time ( char *date_string) gcrd_string_dmy2time (char *date_string)
{ {
struct tm *when;
gint year = 0, month = 0, day = 0; gint year = 0, month = 0, day = 0;
time_t raw_time;
if(qof_scan_date (date_string, &day, &month, &year)) if(qof_scan_date (date_string, &day, &month, &year))
{ {
time(&raw_time); struct tm when;
when = localtime ( &raw_time ); memset (&when, 0, sizeof (when));
when.tm_year = year - 1900;
when.tm_mon = month - 1 ;
when.tm_mday = day;
when->tm_year = year - 1900; return gnc_mktime (&when);
when->tm_mon = month - 1 ;
when->tm_mday = day;
return mktime(when);
} }
else else
{ {
raw_time = time(NULL); return gnc_time (NULL);
return raw_time;
} }
} }

View File

@ -33,7 +33,7 @@
#include <glib-object.h> #include <glib-object.h>
#include <gtk/gtkwidget.h> #include <gtk/gtkwidget.h>
#include <time.h> #include <gnc-date.h>
#include "gnc-cell-renderer-popup.h" #include "gnc-cell-renderer-popup.h"
#include "gnc-cell-renderer-popup-entry.h" #include "gnc-cell-renderer-popup-entry.h"
@ -53,7 +53,7 @@ struct _GncCellRendererDate
GtkWidget *calendar; GtkWidget *calendar;
GtkWidget *today_button; GtkWidget *today_button;
time_t time; time64 time;
gboolean use_buttons; gboolean use_buttons;
GtkWidget *button_box; GtkWidget *button_box;

View File

@ -283,11 +283,6 @@ gnc_date_edit_popup (GNCDateEdit *gde)
mtm.tm_year -= 1900; mtm.tm_year -= 1900;
gnc_tm_set_day_start(&mtm); gnc_tm_set_day_start(&mtm);
if (mktime (&mtm) == (time_t) - 1)
{
gnc_tm_get_today_start (&mtm);
gnc_date_edit_set_time (gde, mktime (&mtm));
}
/* Set the calendar. */ /* Set the calendar. */
gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), 1); gtk_calendar_select_day (GTK_CALENDAR (gde->calendar), 1);
@ -455,7 +450,7 @@ fill_time_combo (GtkWidget *widget, GNCDateEdit *gde)
GtkTreeIter hour_iter, min_iter; GtkTreeIter hour_iter, min_iter;
struct tm *tm_returned; struct tm *tm_returned;
struct tm mtm; struct tm mtm;
time_t current_time; time64 current_time;
int i, j; int i, j;
if (gde->lower_hour > gde->upper_hour) if (gde->lower_hour > gde->upper_hour)
@ -463,8 +458,8 @@ fill_time_combo (GtkWidget *widget, GNCDateEdit *gde)
model = gtk_combo_box_get_model (GTK_COMBO_BOX(gde->time_combo)); model = gtk_combo_box_get_model (GTK_COMBO_BOX(gde->time_combo));
time (&current_time); gnc_time (&current_time);
tm_returned = localtime_r (&current_time, &mtm); tm_returned = gnc_localtime_r (&current_time, &mtm);
g_return_if_fail(tm_returned != NULL); g_return_if_fail(tm_returned != NULL);
for (i = gde->lower_hour; i <= gde->upper_hour; i++) for (i = gde->lower_hour; i <= gde->upper_hour; i++)
@ -646,7 +641,7 @@ gnc_date_edit_set_time_tm (GNCDateEdit *gde, struct tm *mytm)
* to be the one represented by @the_time. * to be the one represented by @the_time.
*/ */
void void
gnc_date_edit_set_time (GNCDateEdit *gde, time_t the_time) gnc_date_edit_set_time (GNCDateEdit *gde, time64 the_time)
{ {
struct tm *tm_returned; struct tm *tm_returned;
struct tm tm_to_set; struct tm tm_to_set;
@ -656,17 +651,10 @@ gnc_date_edit_set_time (GNCDateEdit *gde, time_t the_time)
/* If the_time is invalid, use the last valid time /* If the_time is invalid, use the last valid time
* seen (or as a last resort, the current date). */ * seen (or as a last resort, the current date). */
if (the_time == (time_t) - 1) gde->initial_time = the_time;
{
if (gde->initial_time == (time_t) - 1)
gde->initial_time = gnc_timet_get_today_start();
the_time = gde->initial_time;
}
else
gde->initial_time = the_time;
/* Convert time_t to tm. */ /* Convert time64 to tm. */
tm_returned = localtime_r (&the_time, &tm_to_set); tm_returned = gnc_localtime_r (&the_time, &tm_to_set);
g_return_if_fail(tm_returned != NULL); g_return_if_fail(tm_returned != NULL);
gnc_date_edit_set_time_tm(gde, &tm_to_set); gnc_date_edit_set_time_tm(gde, &tm_to_set);
@ -676,14 +664,13 @@ void
gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date) gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date)
{ {
struct tm mytm; struct tm mytm;
time_t t; time64 t;
g_return_if_fail(gde && GNC_IS_DATE_EDIT(gde) && g_return_if_fail(gde && GNC_IS_DATE_EDIT(gde) &&
date && g_date_valid(date)); date && g_date_valid(date));
g_date_to_struct_tm(date, &mytm); g_date_to_struct_tm(date, &mytm);
t = mktime(&mytm); t = gnc_mktime(&mytm);
if (t != (time_t)(-1)) gnc_date_edit_set_time(gde, t);
gnc_date_edit_set_time(gde, t);
} }
void void
@ -728,7 +715,7 @@ date_accel_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (!gnc_handle_date_accelerator (event, &tm, string)) if (!gnc_handle_date_accelerator (event, &tm, string))
return FALSE; return FALSE;
gnc_date_edit_set_time (gde, mktime (&tm)); gnc_date_edit_set_time (gde, gnc_mktime (&tm));
g_signal_emit (G_OBJECT (gde), date_edit_signals [TIME_CHANGED], 0); g_signal_emit (G_OBJECT (gde), date_edit_signals [TIME_CHANGED], 0);
return TRUE; return TRUE;
@ -752,7 +739,7 @@ date_focus_out_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
/* Get the date entered and attempt to use it. */ /* Get the date entered and attempt to use it. */
tm = gnc_date_edit_get_date_internal (gde); tm = gnc_date_edit_get_date_internal (gde);
gnc_date_edit_set_time (gde, mktime (&tm)); gnc_date_edit_set_time (gde, gnc_mktime (&tm));
/* Get the date again in case it was invalid the first time. */ /* Get the date again in case it was invalid the first time. */
tm = gnc_date_edit_get_date_internal (gde); tm = gnc_date_edit_get_date_internal (gde);
@ -900,7 +887,7 @@ create_children (GNCDateEdit *gde)
* Returns a GNCDateEdit widget. * Returns a GNCDateEdit widget.
*/ */
GtkWidget * GtkWidget *
gnc_date_edit_new (time_t the_time, int show_time, int use_24_format) gnc_date_edit_new (time64 the_time, int show_time, int use_24_format)
{ {
return gnc_date_edit_new_flags return gnc_date_edit_new_flags
(the_time, (the_time,
@ -945,7 +932,7 @@ gnc_date_edit_new_glade (gchar *widget_name,
* Return value: the newly-created date editor widget. * Return value: the newly-created date editor widget.
**/ **/
GtkWidget * GtkWidget *
gnc_date_edit_new_flags (time_t the_time, GNCDateEditFlags flags) gnc_date_edit_new_flags (time64 the_time, GNCDateEditFlags flags)
{ {
GNCDateEdit *gde; GNCDateEdit *gde;
@ -975,11 +962,7 @@ gnc_date_edit_get_date_internal (GNCDateEdit *gde)
tm.tm_mon--; tm.tm_mon--;
/* Hope the user does not actually mean years early in the A.D. days... tm.tm_year -= 1900;
* This date widget will obviously not work for a history program :-)
*/
if (tm.tm_year >= 1900)
tm.tm_year -= 1900;
if (gde->flags & GNC_DATE_EDIT_SHOW_TIME) if (gde->flags & GNC_DATE_EDIT_SHOW_TIME)
{ {
@ -1036,38 +1019,31 @@ gnc_date_edit_get_date_internal (GNCDateEdit *gde)
* *
* Returns the time entered in the GNCDateEdit widget * Returns the time entered in the GNCDateEdit widget
*/ */
time_t time64
gnc_date_edit_get_date (GNCDateEdit *gde) gnc_date_edit_get_date (GNCDateEdit *gde)
{ {
struct tm tm; struct tm tm;
time_t retval; time64 retval;
g_return_val_if_fail (gde != NULL, 0); g_return_val_if_fail (gde != NULL, 0);
g_return_val_if_fail (GNC_IS_DATE_EDIT (gde), 0); g_return_val_if_fail (GNC_IS_DATE_EDIT (gde), 0);
tm = gnc_date_edit_get_date_internal (gde); tm = gnc_date_edit_get_date_internal (gde);
retval = mktime (&tm); return gnc_mktime (&tm);
if (retval == (time_t) - 1)
{
if (gde->initial_time == (time_t) - 1)
return gnc_timet_get_today_start ();
else
return gde->initial_time;
}
return retval;
} }
void void
gnc_date_edit_get_gdate (GNCDateEdit *gde, GDate *date) gnc_date_edit_get_gdate (GNCDateEdit *gde, GDate *date)
{ {
time_t t; time64 t;
g_return_if_fail (gde && date); g_return_if_fail (gde && date);
g_return_if_fail (GNC_IS_DATE_EDIT (gde)); g_return_if_fail (GNC_IS_DATE_EDIT (gde));
t = gnc_date_edit_get_date(gde); t = gnc_date_edit_get_date(gde);
g_date_set_time_t(date, t); g_date_clear (date, 1);
gnc_gdate_set_time64 (date, t);
} }
Timespec Timespec
@ -1087,7 +1063,7 @@ gnc_date_edit_get_date_ts (GNCDateEdit *gde)
* Returns the date entered in the GNCDateEdit widget, * Returns the date entered in the GNCDateEdit widget,
* but with the time adjusted to the end of the day. * but with the time adjusted to the end of the day.
*/ */
time_t time64
gnc_date_edit_get_date_end (GNCDateEdit *gde) gnc_date_edit_get_date_end (GNCDateEdit *gde)
{ {
struct tm tm; struct tm tm;
@ -1098,14 +1074,7 @@ gnc_date_edit_get_date_end (GNCDateEdit *gde)
tm = gnc_date_edit_get_date_internal (gde); tm = gnc_date_edit_get_date_internal (gde);
gnc_tm_set_day_end(&tm); gnc_tm_set_day_end(&tm);
if (mktime (&tm) == (time_t) - 1) return gnc_mktime (&tm);
{
if (gde->initial_time == (time_t) - 1)
return gnc_timet_get_today_end();
else
return gnc_timet_get_day_end(gde->initial_time);
}
return mktime (&tm);
} }
Timespec Timespec

View File

@ -70,16 +70,16 @@ typedef struct
GtkWidget *cal_popup; GtkWidget *cal_popup;
GtkWidget *calendar; GtkWidget *calendar;
time_t initial_time; time64 initial_time;
int lower_hour; int lower_hour;
int upper_hour; int upper_hour;
int flags; int flags;
int disposed; int disposed;
gboolean popup_in_progress; gboolean popup_in_progress;
} GNCDateEdit; } GNCDateEdit;
typedef struct typedef struct
@ -91,7 +91,7 @@ typedef struct
GType gnc_date_edit_get_type (void); GType gnc_date_edit_get_type (void);
GtkWidget *gnc_date_edit_new (time_t the_time, GtkWidget *gnc_date_edit_new (time64 the_time,
int show_time, int use_24_format); int show_time, int use_24_format);
GtkWidget *gnc_date_edit_new_ts (Timespec the_time, GtkWidget *gnc_date_edit_new_ts (Timespec the_time,
int show_time, int use_24_format); int show_time, int use_24_format);
@ -116,20 +116,20 @@ GtkWidget *gnc_date_edit_new_glade (gchar *widget_name,
gchar *string1, gchar *string2, gchar *string1, gchar *string2,
gint int1, gint int2); gint int1, gint int2);
GtkWidget *gnc_date_edit_new_flags (time_t the_time, GtkWidget *gnc_date_edit_new_flags (time64 the_time,
GNCDateEditFlags flags); GNCDateEditFlags flags);
void gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date); void gnc_date_edit_set_gdate (GNCDateEdit *gde, const GDate *date);
void gnc_date_edit_set_time (GNCDateEdit *gde, time_t the_time); void gnc_date_edit_set_time (GNCDateEdit *gde, time64 the_time);
void gnc_date_edit_set_time_ts (GNCDateEdit *gde, Timespec the_time); void gnc_date_edit_set_time_ts (GNCDateEdit *gde, Timespec the_time);
void gnc_date_edit_set_popup_range (GNCDateEdit *gde, void gnc_date_edit_set_popup_range (GNCDateEdit *gde,
int low_hour, int up_hour); int low_hour, int up_hour);
void gnc_date_edit_get_gdate (GNCDateEdit *gde, GDate *date); void gnc_date_edit_get_gdate (GNCDateEdit *gde, GDate *date);
time_t gnc_date_edit_get_date (GNCDateEdit *gde); time64 gnc_date_edit_get_date (GNCDateEdit *gde);
Timespec gnc_date_edit_get_date_ts (GNCDateEdit *gde); Timespec gnc_date_edit_get_date_ts (GNCDateEdit *gde);
time_t gnc_date_edit_get_date_end (GNCDateEdit *gde); time64 gnc_date_edit_get_date_end (GNCDateEdit *gde);
Timespec gnc_date_edit_get_date_end_ts (GNCDateEdit *gde); Timespec gnc_date_edit_get_date_end_ts (GNCDateEdit *gde);
void gnc_date_edit_set_flags (GNCDateEdit *gde, void gnc_date_edit_set_flags (GNCDateEdit *gde,

View File

@ -463,7 +463,7 @@ gnc_date_format_refresh (GNCDateFormat *gdf)
gboolean enable_year, enable_month, enable_custom, check_modifiers; gboolean enable_year, enable_month, enable_custom, check_modifiers;
static gchar *format, *c; static gchar *format, *c;
gchar date_string[MAX_DATE_LEN]; gchar date_string[MAX_DATE_LEN];
time_t secs_now; time64 secs_now;
struct tm today; struct tm today;
g_return_if_fail(gdf); g_return_if_fail(gdf);
@ -541,8 +541,8 @@ gnc_date_format_refresh (GNCDateFormat *gdf)
0, 0, NULL, NULL, gdf); 0, 0, NULL, NULL, gdf);
/* Visual feedback on what the date will look like. */ /* Visual feedback on what the date will look like. */
secs_now = time(NULL); secs_now = gnc_time (NULL);
localtime_r(&secs_now, &today); gnc_localtime_r (&secs_now, &today);
qof_strftime(date_string, MAX_DATE_LEN, format, &today); qof_strftime(date_string, MAX_DATE_LEN, format, &today);
gtk_label_set_text(GTK_LABEL(priv->sample_label), date_string); gtk_label_set_text(GTK_LABEL(priv->sample_label), date_string);
g_free(format); g_free(format);

View File

@ -37,6 +37,7 @@
#include "gnc-dense-cal-model.h" #include "gnc-dense-cal-model.h"
#include "gnc-dense-cal-store.h" #include "gnc-dense-cal-store.h"
#include "Recurrence.h" #include "Recurrence.h"
#include <gnc-gdate-utils.h>
struct _GncDenseCalStore struct _GncDenseCalStore
{ {
@ -137,10 +138,10 @@ gnc_dense_cal_store_new(int num_marks)
} }
model->num_real_marks = 0; model->num_real_marks = 0;
g_date_clear(&model->start_date, 1); g_date_clear(&model->start_date, 1);
g_date_set_time_t(&model->start_date, time(NULL)); gnc_gdate_set_today (&model->start_date);
model->end_type = NEVER_END; model->end_type = NEVER_END;
g_date_clear(&model->end_date, 1); g_date_clear(&model->end_date, 1);
g_date_set_time_t(&model->end_date, time(NULL)); gnc_gdate_set_today (&model->end_date);
model->n_occurrences = 0; model->n_occurrences = 0;
return model; return model;
} }

View File

@ -30,6 +30,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <gnc-gdate-utils.h>
/** /**
* Marking ... * Marking ...
@ -402,11 +403,11 @@ gnc_dense_cal_init(GncDenseCal *dcal)
dcal->topPadding = 2; dcal->topPadding = 2;
{ {
GDate *now = g_date_new(); GDate now;
g_date_set_time_t(now, time(NULL)); g_date_clear (&now, 1);
_gnc_dense_cal_set_month(dcal, g_date_get_month(now), FALSE); gnc_gdate_set_today (&now);
_gnc_dense_cal_set_year(dcal, g_date_get_year(now), FALSE); _gnc_dense_cal_set_month(dcal, g_date_get_month(&now), FALSE);
g_date_free(now); _gnc_dense_cal_set_year(dcal, g_date_get_year(&now), FALSE);
} }
recompute_extents(dcal); recompute_extents(dcal);

View File

@ -569,7 +569,7 @@ gnc_file_query_save (gboolean can_cancel)
gint response; gint response;
const char *title = _("Save changes to the file?"); const char *title = _("Save changes to the file?");
/* This should be the same message as in gnc-main-window.c */ /* This should be the same message as in gnc-main-window.c */
time_t oldest_change; time64 oldest_change;
gint minutes; gint minutes;
dialog = gtk_message_dialog_new(GTK_WINDOW(parent), dialog = gtk_message_dialog_new(GTK_WINDOW(parent),
@ -578,7 +578,7 @@ gnc_file_query_save (gboolean can_cancel)
GTK_BUTTONS_NONE, GTK_BUTTONS_NONE,
"%s", title); "%s", title);
oldest_change = qof_book_get_session_dirty_time(current_book); oldest_change = qof_book_get_session_dirty_time(current_book);
minutes = (time(NULL) - oldest_change) / 60 + 1; minutes = (gnc_time (NULL) - oldest_change) / 60 + 1;
gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
ngettext("If you don't save, changes from the past %d minute will be discarded.", ngettext("If you don't save, changes from the past %d minute will be discarded.",
"If you don't save, changes from the past %d minutes will be discarded.", "If you don't save, changes from the past %d minutes will be discarded.",

View File

@ -1134,7 +1134,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
_("If you don't save, changes from the past %d hours and %d minutes will be discarded."); _("If you don't save, changes from the past %d hours and %d minutes will be discarded.");
const gchar *message_days = const gchar *message_days =
_("If you don't save, changes from the past %d days and %d hours will be discarded."); _("If you don't save, changes from the past %d days and %d hours will be discarded.");
time_t oldest_change; time64 oldest_change;
gint minutes, hours, days; gint minutes, hours, days;
session = gnc_get_current_session(); session = gnc_get_current_session();
@ -1155,7 +1155,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window)
title, title,
filename); filename);
oldest_change = qof_book_get_session_dirty_time(book); oldest_change = qof_book_get_session_dirty_time(book);
minutes = (time(NULL) - oldest_change) / 60 + 1; minutes = (gnc_time (NULL) - oldest_change) / 60 + 1;
hours = minutes / 60; hours = minutes / 60;
minutes = minutes % 60; minutes = minutes % 60;
days = hours / 24; days = hours / 24;

View File

@ -37,6 +37,7 @@
#include "gnc-date.h" #include "gnc-date.h"
#include "gnc-gconf-utils.h" #include "gnc-gconf-utils.h"
#include "gnc-period-select.h" #include "gnc-period-select.h"
#include <gnc-gdate-utils.h>
enum enum
{ {
@ -138,17 +139,27 @@ static void
gnc_period_sample_update_date_label (GncPeriodSelect *period) gnc_period_sample_update_date_label (GncPeriodSelect *period)
{ {
GncPeriodSelectPrivate *priv; GncPeriodSelectPrivate *priv;
gchar *time_string; gchar time_string[MAX_DATE_LENGTH];
time_t secs; GDate *date;
GncAccountingPeriod which;
g_return_if_fail(GNC_IS_PERIOD_SELECT(period)); g_return_if_fail(GNC_IS_PERIOD_SELECT(period));
priv = GNC_PERIOD_SELECT_GET_PRIVATE(period); priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
if (!priv->date_label) if (!priv->date_label)
return; return;
secs = gnc_period_select_get_time(GNC_PERIOD_SELECT(period)); which = gtk_combo_box_get_active (GTK_COMBO_BOX (priv->selector));
time_string = qof_print_date(secs); if (which == -1)
gtk_label_set_label(GTK_LABEL(priv->date_label), time_string); date = g_date_new_dmy (1, 1, 1970);
g_free(time_string);
else if (priv->start)
date = gnc_accounting_period_start_gdate (which, priv->fy_end,
priv->date_base);
else
date = gnc_accounting_period_end_gdate (which, priv->fy_end,
priv->date_base);
qof_print_gdate (time_string, MAX_DATE_LENGTH, date);
gtk_label_set_label (GTK_LABEL(priv->date_label), time_string);
g_date_free (date);
} }
@ -336,7 +347,7 @@ gnc_period_select_set_show_date (GncPeriodSelect *period, const gboolean show_da
if (show_date) if (show_date)
{ {
g_date_clear(&date, 1); g_date_clear(&date, 1);
g_date_set_time_t(&date, time (NULL)); gnc_gdate_set_time64(&date, gnc_time (NULL));
gnc_period_select_set_date_common(period, &date); gnc_period_select_set_date_common(period, &date);
} }
else else
@ -732,30 +743,4 @@ gnc_period_select_get_date (GncPeriodSelect *period)
priv->date_base); priv->date_base);
} }
/* Get the currently selected accounting period from a
* GncPeriodSelect widget. This is used to retrieve the user's
* selection in the form of an timestamp.
*/
time_t
gnc_period_select_get_time (GncPeriodSelect *period)
{
GncPeriodSelectPrivate *priv;
GncAccountingPeriod which;
g_return_val_if_fail(period != NULL, 0);
g_return_val_if_fail(GNC_IS_PERIOD_SELECT(period), 0);
priv = GNC_PERIOD_SELECT_GET_PRIVATE(period);
which = gtk_combo_box_get_active(GTK_COMBO_BOX(priv->selector));
if (which == -1)
return 0;
if (priv->start)
return gnc_accounting_period_start_timet(which, priv->fy_end,
priv->date_base);
return gnc_accounting_period_end_timet(which, priv->fy_end,
priv->date_base);
}
/** @} */ /** @} */

View File

@ -182,17 +182,6 @@ GncAccountingPeriod gnc_period_select_get_active (GncPeriodSelect *period);
* @return The starting/ending time. */ * @return The starting/ending time. */
GDate *gnc_period_select_get_date (GncPeriodSelect *period); GDate *gnc_period_select_get_date (GncPeriodSelect *period);
/** Get the currently selected accounting period choice from a
* GncPeriodSelect widget. This is used to retrieve the user's
* selection in the form of an timestamp.
*
* @param period The selection widget to query.
*
* @return The starting/ending time (in seconds since 1970-01-01) of
* the accounting period selected by the user.
*/
time_t gnc_period_select_get_time (GncPeriodSelect *period);
G_END_DECLS G_END_DECLS
#endif /* GNC_PERIOD_SELECT_H */ #endif /* GNC_PERIOD_SELECT_H */

View File

@ -138,14 +138,12 @@ something_changed( GtkWidget *wid, gpointer d )
{ {
UIPeriodType pt; UIPeriodType pt;
GDate start; GDate start;
time_t t;
gboolean show_last, use_wd; gboolean show_last, use_wd;
GncRecurrence *gr = GNC_RECURRENCE(d); GncRecurrence *gr = GNC_RECURRENCE(d);
pt = get_pt_ui(gr); pt = get_pt_ui(gr);
t = gnc_date_edit_get_date(GNC_DATE_EDIT(gr->gde_start)); gnc_date_edit_get_gdate(GNC_DATE_EDIT(gr->gde_start), &start);
g_date_set_time_t(&start, t);
if (pt == GNCR_MONTH) if (pt == GNCR_MONTH)
g_object_set(G_OBJECT(gr->nth_weekday), "visible", TRUE, NULL); g_object_set(G_OBJECT(gr->nth_weekday), "visible", TRUE, NULL);
@ -197,7 +195,7 @@ gnc_recurrence_init( GncRecurrence *gr )
vb = GTK_VBOX(gtk_builder_get_object (builder, "RecurrenceEntryVBox")); vb = GTK_VBOX(gtk_builder_get_object (builder, "RecurrenceEntryVBox"));
hb = GTK_HBOX(gtk_builder_get_object (builder, "Startdate_hbox")); hb = GTK_HBOX(gtk_builder_get_object (builder, "Startdate_hbox"));
w = gnc_date_edit_new (time (NULL), FALSE, FALSE); w = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
gr->gde_start = w; gr->gde_start = w;
gtk_box_pack_start (GTK_BOX (hb), w, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hb), w, TRUE, TRUE, 0);
gtk_widget_show (w); gtk_widget_show (w);
@ -250,9 +248,9 @@ gnc_recurrence_set(GncRecurrence *gr, const Recurrence *r)
// is there some better way? // is there some better way?
{ {
time_t t; time64 t;
t = gnc_timet_get_day_start_gdate (&start); t = gnc_time64_get_day_start_gdate (&start);
gnc_date_edit_set_time(GNC_DATE_EDIT(gr->gde_start), t); gnc_date_edit_set_time (GNC_DATE_EDIT(gr->gde_start), t);
} }
set_pt_ui(gr, pt); set_pt_ui(gr, pt);
@ -262,7 +260,6 @@ gnc_recurrence_set(GncRecurrence *gr, const Recurrence *r)
const Recurrence * const Recurrence *
gnc_recurrence_get(GncRecurrence *gr) gnc_recurrence_get(GncRecurrence *gr)
{ {
time_t t;
guint mult; guint mult;
UIPeriodType period; UIPeriodType period;
PeriodType pt; PeriodType pt;
@ -270,8 +267,7 @@ gnc_recurrence_get(GncRecurrence *gr)
gboolean use_eom = FALSE, rel; gboolean use_eom = FALSE, rel;
mult = (guint) gtk_spin_button_get_value_as_int(gr->gsb_mult); mult = (guint) gtk_spin_button_get_value_as_int(gr->gsb_mult);
t = gnc_date_edit_get_date(GNC_DATE_EDIT(gr->gde_start)); gnc_date_edit_get_gdate(GNC_DATE_EDIT(gr->gde_start), &start);
g_date_set_time_t(&start, t);
period = get_pt_ui(gr); period = get_pt_ui(gr);
switch (period) switch (period)

View File

@ -578,7 +578,7 @@ gnc_tree_model_account_compute_period_balance(GncTreeModelAccount *model,
gboolean *negative) gboolean *negative)
{ {
GncTreeModelAccountPrivate *priv; GncTreeModelAccountPrivate *priv;
time_t t1, t2; time64 t1, t2;
gnc_numeric b3; gnc_numeric b3;
if ( negative ) if ( negative )
@ -615,7 +615,7 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
Account *account; Account *account;
gboolean negative; /* used to set "deficit style" also known as red numbers */ gboolean negative; /* used to set "deficit style" also known as red numbers */
gchar *string; gchar *string;
time_t last_date; time64 last_date;
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model)); g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (model));
g_return_if_fail (iter != NULL); g_return_if_fail (iter != NULL);

View File

@ -450,7 +450,7 @@ sort_by_xxx_period_value (GtkTreeModel *f_model,
gboolean recurse) gboolean recurse)
{ {
Account *acct1, *acct2; Account *acct1, *acct2;
time_t t1, t2; time64 t1, t2;
gnc_numeric b1, b2; gnc_numeric b1, b2;
gint result; gint result;

View File

@ -859,7 +859,7 @@ g_print("handle_exchange_rate trans %p and split %p\n", trans, split);
gnc_xfer_dialog_set_description (xfer, xaccTransGetDescription (trans)); gnc_xfer_dialog_set_description (xfer, xaccTransGetDescription (trans));
gnc_xfer_dialog_set_memo (xfer, xaccSplitGetMemo (split)); gnc_xfer_dialog_set_memo (xfer, xaccSplitGetMemo (split));
gnc_xfer_dialog_set_num (xfer, xaccTransGetNum (trans)); gnc_xfer_dialog_set_num (xfer, xaccTransGetNum (trans));
gnc_xfer_dialog_set_date (xfer, timespecToTime_t (xaccTransRetDatePostedTS (trans))); gnc_xfer_dialog_set_date (xfer, timespecToTime64 (xaccTransRetDatePostedTS (trans)));
value = amount; value = amount;
if (gnc_xfer_dialog_run_exchange_dialog ( if (gnc_xfer_dialog_run_exchange_dialog (
@ -1388,7 +1388,7 @@ cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
//date on new transactions //date on new transactions
if (ts.tv_sec == 0) if (ts.tv_sec == 0)
{ {
ts.tv_sec = time (NULL); ts.tv_sec = gnc_time (NULL);
//xaccTransSetDatePostedSecs(trans, ts.tv_sec); //xaccTransSetDatePostedSecs(trans, ts.tv_sec);
}//if }//if
s = gnc_print_date(ts); s = gnc_print_date(ts);
@ -1960,7 +1960,7 @@ g_print("begin_edit - xaccTransBeginEdit trans %p\n", trans);
//is a new transaction and set the time to current time to show current //is a new transaction and set the time to current time to show current
//date on new transactions //date on new transactions
ts.tv_sec = time (NULL); ts.tv_sec = gnc_time (NULL);
xaccTransSetDatePostedSecs(trans, ts.tv_sec); xaccTransSetDatePostedSecs(trans, ts.tv_sec);
} }
} }
@ -1975,9 +1975,8 @@ remove_edit_date (GtkCellEditable *ce, gpointer user_data)
const gchar *new_string; const gchar *new_string;
const gchar *current_string; const gchar *current_string;
GDate date; GDate date;
struct tm *tm;
char string[1024]; char string[1024];
time_t tt; time64 tt;
//These strings are used to determine if cell data was altered so that keynav works better //These strings are used to determine if cell data was altered so that keynav works better
g_print("\nremove edit date\n"); g_print("\nremove edit date\n");
@ -2001,11 +2000,10 @@ g_print("\nremove edit date\n");
g_date_set_parse (&date, new_string); g_date_set_parse (&date, new_string);
if (g_date_valid (&date)) if (g_date_valid (&date))
{ {
time (&tt); struct tm tm;
tm = localtime (&tt); memset (&tm, 0, sizeof (tm));
g_date_to_struct_tm (&date, &tm);
g_date_to_struct_tm (&date, tm); qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm);
qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
} }
view->help_text = g_strdup (string); view->help_text = g_strdup (string);
g_signal_emit_by_name (view, "help_signal", NULL); g_signal_emit_by_name (view, "help_signal", NULL);
@ -2518,19 +2516,16 @@ gtv_split_reg_help (GncTreeViewSplitReg *view, GtkCellRenderer *cr, ViewCol view
if(depth == TRANS1) if(depth == TRANS1)
{ {
GDate date; GDate date;
struct tm *tm;
char string[1024]; char string[1024];
time_t tt;
current_string = g_object_get_data (G_OBJECT (cr), "current-string"); current_string = g_object_get_data (G_OBJECT (cr), "current-string");
g_date_set_parse (&date, current_string); g_date_set_parse (&date, current_string);
if (g_date_valid (&date)) if (g_date_valid (&date))
{ {
time (&tt); struct tm tm;
tm = localtime (&tt); memset (&tm, 0, sizeof (tm));
g_date_to_struct_tm (&date, &tm);
g_date_to_struct_tm (&date, tm); qof_strftime (string, sizeof (string), "%A %d %B %Y", &tm);
qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
} }
help = g_strdup (string); help = g_strdup (string);
} }

View File

@ -87,8 +87,8 @@ typedef struct
gboolean euro; gboolean euro;
gboolean grand_total; gboolean grand_total;
gboolean non_currency; gboolean non_currency;
time_t start_date; time64 start_date;
time_t end_date; time64 end_date;
} GNCSummarybarOptions; } GNCSummarybarOptions;
/** /**
@ -196,11 +196,11 @@ gnc_ui_accounts_recurse (Account *parent, GList **currency_list,
case ACCT_TYPE_PAYABLE: case ACCT_TYPE_PAYABLE:
case ACCT_TYPE_RECEIVABLE: case ACCT_TYPE_RECEIVABLE:
end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date); end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date);
timespecFromTime_t(&end_timespec, options.end_date); timespecFromTime64(&end_timespec, options.end_date);
end_amount_default_currency = end_amount_default_currency =
xaccAccountConvertBalanceToCurrencyAsOfDate xaccAccountConvertBalanceToCurrencyAsOfDate
(account, end_amount, account_currency, options.default_currency, (account, end_amount, account_currency, options.default_currency,
timespecToTime_t(timespecCanonicalDayTime(end_timespec))); timespecToTime64(timespecCanonicalDayTime(end_timespec)));
if (!non_currency || options.non_currency) if (!non_currency || options.non_currency)
{ {
@ -240,17 +240,17 @@ gnc_ui_accounts_recurse (Account *parent, GList **currency_list,
case ACCT_TYPE_INCOME: case ACCT_TYPE_INCOME:
case ACCT_TYPE_EXPENSE: case ACCT_TYPE_EXPENSE:
start_amount = xaccAccountGetBalanceAsOfDate(account, options.start_date); start_amount = xaccAccountGetBalanceAsOfDate(account, options.start_date);
timespecFromTime_t(&start_timespec, options.start_date); timespecFromTime64(&start_timespec, options.start_date);
start_amount_default_currency = start_amount_default_currency =
xaccAccountConvertBalanceToCurrencyAsOfDate xaccAccountConvertBalanceToCurrencyAsOfDate
(account, start_amount, account_currency, options.default_currency, (account, start_amount, account_currency, options.default_currency,
timespecToTime_t(timespecCanonicalDayTime(start_timespec))); timespecToTime64(timespecCanonicalDayTime(start_timespec)));
end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date); end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date);
timespecFromTime_t(&end_timespec, options.end_date); timespecFromTime64(&end_timespec, options.end_date);
end_amount_default_currency = end_amount_default_currency =
xaccAccountConvertBalanceToCurrencyAsOfDate xaccAccountConvertBalanceToCurrencyAsOfDate
(account, end_amount, account_currency, options.default_currency, (account, end_amount, account_currency, options.default_currency,
timespecToTime_t(timespecCanonicalDayTime(end_timespec))); timespecToTime64(timespecCanonicalDayTime(end_timespec)));
if (!non_currency || options.non_currency) if (!non_currency || options.non_currency)
{ {