r22626 - gnucash/trunk/src/gnome - Convert all time_t to time64: gnome
John Ralls
jralls at code.gnucash.org
Sat Dec 1 17:45:49 EST 2012
Author: jralls
Date: 2012-12-01 17:45:49 -0500 (Sat, 01 Dec 2012)
New Revision: 22626
Trac: http://svn.gnucash.org/trac/changeset/22626
Modified:
gnucash/trunk/src/gnome/assistant-acct-period.c
gnucash/trunk/src/gnome/assistant-hierarchy.c
gnucash/trunk/src/gnome/assistant-loan.c
gnucash/trunk/src/gnome/assistant-stock-split.c
gnucash/trunk/src/gnome/dialog-lot-viewer.c
gnucash/trunk/src/gnome/dialog-price-editor.c
gnucash/trunk/src/gnome/dialog-print-check.c
gnucash/trunk/src/gnome/dialog-sx-editor.c
gnucash/trunk/src/gnome/dialog-sx-from-trans.c
gnucash/trunk/src/gnome/gnc-plugin-page-register.c
gnucash/trunk/src/gnome/gnc-plugin-page-register2.c
gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c
gnucash/trunk/src/gnome/gnc-split-reg.c
gnucash/trunk/src/gnome/gnc-split-reg.h
gnucash/trunk/src/gnome/gnc-split-reg2.c
gnucash/trunk/src/gnome/gnc-split-reg2.h
gnucash/trunk/src/gnome/reconcile-view.c
gnucash/trunk/src/gnome/reconcile-view.h
gnucash/trunk/src/gnome/window-reconcile.c
gnucash/trunk/src/gnome/window-reconcile.h
Log:
Convert all time_t to time64: gnome
Modified: gnucash/trunk/src/gnome/assistant-acct-period.c
===================================================================
--- gnucash/trunk/src/gnome/assistant-acct-period.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/assistant-acct-period.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -73,7 +73,7 @@
GtkWidget * apply_label;
GtkWidget * summary;
- time_t earliest;
+ time64 earliest;
char * earliest_str;
GDate closing_date;
GDate prev_closing_date;
@@ -102,13 +102,13 @@
* a query and sorting by date. Since the truncated sort returns
* only the *last* search results, sort in decreasing order.
*/
-static time_t
+static time64
get_earliest_in_book (QofBook *book)
{
QofQuery *q;
GSList *p1, *p2;
GList *res;
- time_t earliest;
+ time64 earliest;
q = qof_query_create_for(GNC_ID_SPLIT);
qof_query_set_max_results(q, 1);
@@ -133,7 +133,7 @@
else
{
/* If no results, we don't want to bomb totally */
- earliest = time (0);
+ earliest = gnc_time (NULL);
}
qof_query_destroy (q);
@@ -146,7 +146,7 @@
*/
static int
-get_num_xactions_before_date(QofBook *book, time_t close_date)
+get_num_xactions_before_date(QofBook *book, time64 close_date)
{
QofQuery *q;
GSList *param;
@@ -161,7 +161,7 @@
/* Look for transactions earlier than the closing date */
param = g_slist_prepend (NULL, TRANS_DATE_POSTED);
- timespecFromTime_t (&ts, close_date);
+ timespecFromTime64 (&ts, close_date);
pred = qof_query_date_predicate (QOF_COMPARE_LTE, QOF_DATE_MATCH_NORMAL, ts);
qof_query_add_term (q, param, pred, QOF_QUERY_FIRST_TERM);
@@ -284,7 +284,7 @@
g_date_clear (&date_now, 1);
nperiods = 0;
period_end = info->closing_date;
- g_date_set_time_t (&date_now, time(NULL));
+ gnc_gdate_set_time64 (&date_now, gnc_time (NULL));
while (0 > g_date_compare(&period_end, &date_now ))
{
@@ -306,7 +306,8 @@
* we may have closed books since last time. */
info->earliest = get_earliest_in_book (gnc_get_current_book());
info->earliest_str = qof_print_date(info->earliest);
- PINFO ("Date of earliest transaction is %ld %s", info->earliest, ctime (&info->earliest));
+ PINFO ("Date of earliest transaction is %lld %s", info->earliest,
+ gnc_ctime (&info->earliest));
/* Display the results */
str = g_strdup_printf (
@@ -361,7 +362,7 @@
currbook = gnc_get_current_book();
ntrans = get_num_xactions_before_date(currbook,
- gnc_timet_get_day_end_gdate (&info->closing_date));
+ gnc_time64_get_day_end_gdate (&info->closing_date));
nacc = gnc_account_n_descendants (gnc_book_get_root_account (currbook));
@@ -448,7 +449,7 @@
}
g_date_clear (&date_now, 1);
- g_date_set_time_t (&date_now, time(NULL));
+ gnc_gdate_set_today (&date_now);
if (0 < g_date_compare(&info->closing_date, &date_now))
{
/* Closing date must be in the future */
@@ -481,8 +482,8 @@
bnotes = gtk_text_buffer_get_text(buffer, &startiter, &enditer , 0);
PINFO("Book title is - %s\n", btitle);
- timespecFromTime_t (&closing_date,
- gnc_timet_get_day_end_gdate (&info->closing_date));
+ timespecFromTime64 (&closing_date,
+ gnc_time64_get_day_end_gdate (&info->closing_date));
g_free(bnotes);
/* Report the status back to the user. */
@@ -490,17 +491,20 @@
/* Find the next closing date ... */
info->prev_closing_date = info->closing_date;
- recurrenceListNextInstance(info->period, &info->prev_closing_date, &info->closing_date);
+ recurrenceListNextInstance (info->period, &info->prev_closing_date,
+ &info->closing_date);
/* FIXME Test for valid closing date, not sure why it wont be!!! */
if (g_date_valid(&info->closing_date) == TRUE)
{
/* If the next closing date is in the future, then we are done. */
- if (time(NULL) > gnc_timet_get_day_end_gdate (&info->closing_date))
+ if (gnc_time (NULL) >
+ gnc_time64_get_day_end_gdate (&info->closing_date))
{
/* Load up the GUI for the next closing period. */
- gnc_frequency_setup_recurrence(info->period_menu, NULL, &info->closing_date);
+ gnc_frequency_setup_recurrence (info->period_menu, NULL,
+ &info->closing_date);
/* Jump back to the Close Book page. */
gtk_assistant_set_current_page (GTK_ASSISTANT(info->window), 1);
}
@@ -567,11 +571,11 @@
* and use that to set up the freq spec widget. */
info->earliest = get_earliest_in_book (gnc_get_current_book());
info->earliest_str = qof_print_date(info->earliest);
- PINFO ("date of earliest transaction is %ld %s",
- info->earliest, ctime (&info->earliest));
+ PINFO ("date of earliest transaction is %lld %s",
+ info->earliest, gnc_ctime (&info->earliest));
g_date_clear (&info->closing_date, 1);
- g_date_set_time_t (&info->closing_date, info->earliest);
+ gnc_gdate_set_time64 (&info->closing_date, info->earliest);
g_date_clear (&info->prev_closing_date, 1);
info->prev_closing_date = info->closing_date;
g_date_add_years (&info->closing_date, 1);
Modified: gnucash/trunk/src/gnome/assistant-hierarchy.c
===================================================================
--- gnucash/trunk/src/gnome/assistant-hierarchy.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/assistant-hierarchy.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -1006,7 +1006,7 @@
if (gnc_reverse_balance(account))
balance = gnc_numeric_neg(balance);
if (!gnc_numeric_zero_p (balance))
- gnc_account_create_opening_balance (account, balance, time (NULL),
+ gnc_account_create_opening_balance (account, balance, gnc_time (NULL),
gnc_get_current_book ());
}
Modified: gnucash/trunk/src/gnome/assistant-loan.c
===================================================================
--- gnucash/trunk/src/gnome/assistant-loan.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/assistant-loan.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -655,7 +655,7 @@
{
*gde_data[i].loc =
GNC_DATE_EDIT(
- gnc_date_edit_new( time(NULL),
+ gnc_date_edit_new( gnc_time (NULL),
FALSE, FALSE ) );
gtk_table_attach( gde_data[i].table,
GTK_WIDGET( *gde_data[i].loc ),
@@ -901,7 +901,7 @@
ldd->ld.principal = gnc_numeric_zero();
ldd->ld.startDate = g_date_new();
ldd->ld.varStartDate = g_date_new();
- g_date_set_time_t( ldd->ld.startDate, time(NULL) );
+ gnc_gdate_set_time64( ldd->ld.startDate, gnc_time (NULL) );
ldd->ld.loan_schedule = NULL;
ldd->ld.repayment_schedule = NULL;
{
@@ -967,10 +967,10 @@
tmpTm = g_new0( struct tm, 1 );
- g_date_to_struct_tm( ldd->ld.startDate, tmpTm );
- gnc_date_edit_set_time( ldd->prmStartDateGDE,
- mktime(tmpTm) );
- g_free( tmpTm );
+ g_date_to_struct_tm (ldd->ld.startDate, tmpTm);
+ gnc_date_edit_set_time (ldd->prmStartDateGDE,
+ gnc_mktime (tmpTm));
+ g_free (tmpTm);
}
/* length: total and remaining */
@@ -1005,8 +1005,8 @@
g_date_clear( &start, 1 );
g_date_clear( &now, 1 );
- g_date_set_time_t( &start, gnc_date_edit_get_date( ldd->prmStartDateGDE ) );
- g_date_set_time_t( &now, time(NULL) );
+ gnc_gdate_set_time64( &start, gnc_date_edit_get_date( ldd->prmStartDateGDE ) );
+ gnc_gdate_set_time64( &now, gnc_time (NULL) );
for ( i = 0; g_date_compare( &start, &now ) < 0; i++ )
{
g_date_add_months( &start, 1 );
@@ -1083,15 +1083,16 @@
/* start date */
{
- time_t tmpTT;
+ time64 tmpTT;
struct tm *tmpTm;
tmpTT = gnc_date_edit_get_date( ldd->prmStartDateGDE );
- tmpTm = localtime( &tmpTT );
+ tmpTm = gnc_localtime ( &tmpTT );
g_date_set_dmy( ldd->ld.startDate,
tmpTm->tm_mday,
(tmpTm->tm_mon + 1),
(1900 + tmpTm->tm_year) );
+ gnc_tm_free (tmpTm);
}
/* len / periods */
@@ -1923,12 +1924,12 @@
*start = *ldd->ld.startDate;
endDateMath = g_new0( struct tm, 1 );
- g_date_to_struct_tm( ldd->ld.startDate, endDateMath );
+ g_date_to_struct_tm (ldd->ld.startDate, endDateMath);
monthsTotal = ( (ldd->ld.numPer - 1)
* ( ldd->ld.perSize == GNC_MONTHS ? 1 : 12 ) );
endDateMath->tm_mon += monthsTotal;
- g_date_set_time_t( end, mktime( endDateMath ) );
- g_free( endDateMath );
+ gnc_gdate_set_time64 (end, gnc_mktime (endDateMath));
+ g_free (endDateMath);
}
@@ -1940,12 +1941,12 @@
switch ( range )
{
case CURRENT_YEAR:
- g_date_set_time_t( start, time(NULL) );
+ gnc_gdate_set_time64( start, gnc_time (NULL) );
g_date_set_dmy( start, 1, G_DATE_JANUARY, g_date_get_year( start ) );
g_date_set_dmy( end, 31, G_DATE_DECEMBER, g_date_get_year( start ) );
break;
case NOW_PLUS_ONE:
- g_date_set_time_t( start, time(NULL) );
+ gnc_gdate_set_time64( start, gnc_time (NULL) );
*end = *start;
g_date_add_years( end, 1 );
break;
@@ -1953,9 +1954,9 @@
loan_rev_get_loan_range( ldd, start, end );
break;
case CUSTOM:
- g_date_set_time_t( start,
+ gnc_gdate_set_time64( start,
gnc_date_edit_get_date( ldd->revStartDate ) );
- g_date_set_time_t( end,
+ gnc_gdate_set_time64( end,
gnc_date_edit_get_date( ldd->revEndDate ) );
break;
default:
@@ -2524,7 +2525,7 @@
g_date_clear(&next_date, 1);
g_date_clear(&today, 1);
- g_date_set_time_t(&today, time(NULL));
+ gnc_gdate_set_time64 (&today, gnc_time (NULL));
if (g_date_compare(start_date, &today) > 0)
return 0;
Modified: gnucash/trunk/src/gnome/assistant-stock-split.c
===================================================================
--- gnucash/trunk/src/gnome/assistant-stock-split.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/assistant-stock-split.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -365,7 +365,7 @@
Transaction *trans;
Account *account;
Split *split;
- time_t date;
+ time64 date;
account = info->acct;
g_return_if_fail (account != NULL);
@@ -632,7 +632,7 @@
info->description_entry = GTK_WIDGET(gtk_builder_get_object(builder, "description_entry"));
box = GTK_WIDGET(gtk_builder_get_object(builder, "date_box"));
- date = gnc_date_edit_new(time(NULL), FALSE, FALSE);
+ date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
gtk_box_pack_start (GTK_BOX (box), date, TRUE, TRUE, 0);
info->date_edit = date;
label = GTK_WIDGET(gtk_builder_get_object(builder, "date_label"));
Modified: gnucash/trunk/src/gnome/dialog-lot-viewer.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-lot-viewer.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/dialog-lot-viewer.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -357,7 +357,7 @@
GNCLot *lot = node->data;
Split *esplit = gnc_lot_get_earliest_split (lot);
Transaction *etrans = xaccSplitGetParent (esplit);
- time_t open_date = xaccTransGetDate (etrans);
+ time64 open_date = xaccTransGetDate (etrans);
gnc_numeric amt_baln = gnc_lot_get_balance (lot);
gnc_commodity *currency = find_first_currency (lot);
gnc_numeric gains_baln = get_realized_gains (lot, currency);
@@ -388,7 +388,7 @@
{
Split *fsplit = gnc_lot_get_latest_split (lot);
Transaction *ftrans = xaccSplitGetParent (fsplit);
- time_t close_date = xaccTransGetDate (ftrans);
+ time64 close_date = xaccTransGetDate (ftrans);
qof_print_date_buff (cbuff, MAX_DATE_LENGTH, close_date);
gtk_list_store_set(store, &iter, LOT_COL_CLOSE, cbuff, -1);
@@ -500,7 +500,7 @@
char balnbuff[200];
gnc_commodity *currency;
Transaction *trans = xaccSplitGetParent (split);
- time_t date = xaccTransGetDate (trans);
+ time64 date = xaccTransGetDate (trans);
gnc_numeric amnt, valu, gains;
/* Do not show gains splits */
Modified: gnucash/trunk/src/gnome/dialog-price-editor.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-price-editor.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/dialog-price-editor.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -170,7 +170,7 @@
else
{
currency = gnc_default_currency ();
- date.tv_sec = time (NULL);
+ date.tv_sec = gnc_time (NULL);
date.tv_nsec = 0;
source = DIALOG_PRICE_EDIT_SOURCE;
type = "";
Modified: gnucash/trunk/src/gnome/dialog-print-check.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-print-check.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/dialog-print-check.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -37,6 +37,7 @@
#include <locale.h>
#include <math.h>
+#include <gnc-gdate-utils.h>
#include "qof.h"
#include "gnc-date.h"
#include "gnc-gconf-utils.h"
@@ -2124,7 +2125,6 @@
GSList *elem;
check_item_t *item;
gdouble width;
- GDate *date;
gchar *address = NULL;
trans = xaccSplitGetParent(pcd->split);
@@ -2145,16 +2145,18 @@
switch (item->type)
{
case DATE:
- date = g_date_new();
- g_date_set_time_t(date, xaccTransGetDate(trans));
+ {
+ GDate date;
+ g_date_clear (&date, 1);
+ gnc_gdate_set_time64 (&date, xaccTransGetDate(trans));
date_format =
gnc_date_format_get_custom(GNC_DATE_FORMAT
(pcd->date_format));
- g_date_strftime(buf, 100, date_format, date);
+ g_date_strftime(buf, 100, date_format, &date);
width = draw_text(context, buf, item, default_desc);
draw_date_format(context, date_format, item, default_desc, width);
- g_date_free(date);
break;
+ }
case PAYEE:
draw_text(context, xaccTransGetDescription(trans), item, default_desc);
@@ -2331,7 +2333,7 @@
gchar *text = NULL, buf[100];
check_item_t item = { 0 };
gdouble x, y, multip, degrees;
- GDate *date;
+ GDate date;
gchar *address;
trans = xaccSplitGetParent(pcd->split);
@@ -2357,12 +2359,11 @@
item.x = multip * gtk_spin_button_get_value(pcd->date_x);
item.y = multip * gtk_spin_button_get_value(pcd->date_y);
- date = g_date_new();
- g_date_set_time_t(date, xaccTransGetDate(trans));
+ g_date_clear (&date, 1);
+ gnc_gdate_set_time64 (&date, xaccTransGetDate(trans));
date_format = gnc_date_format_get_custom(GNC_DATE_FORMAT(pcd->date_format));
- g_date_strftime(buf, 100, date_format, date);
+ g_date_strftime(buf, 100, date_format, &date);
draw_text(context, buf, &item, desc);
- g_date_free(date);
item.x = multip * gtk_spin_button_get_value(pcd->number_x);
item.y = multip * gtk_spin_button_get_value(pcd->number_y);
Modified: gnucash/trunk/src/gnome/dialog-sx-editor.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-editor.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/dialog-sx-editor.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -37,8 +37,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <locale.h>
-#include <time.h>
+#include <gnc-gdate-utils.h>
#include "qof.h"
#include "Account.h"
#include "SchedXaction.h"
@@ -314,7 +314,7 @@
return TRUE;
}
sxEndDate = *xaccSchedXactionGetEndDate( sxed->sx );
- g_date_set_time_t( &dlgEndDate,
+ gnc_gdate_set_time64( &dlgEndDate,
gnc_date_edit_get_date( sxed->
endDateEntry ) );
@@ -858,7 +858,7 @@
g_date_clear( &endDate, 1 );
if ( gtk_toggle_button_get_active(sxed->optEndDate) )
{
- g_date_set_time_t( &endDate,
+ gnc_gdate_set_time64( &endDate,
gnc_date_edit_get_date( sxed->
endDateEntry ) );
}
@@ -913,7 +913,7 @@
if ( gtk_toggle_button_get_active(sxed->optEndDate) )
{
/* get the end date data */
- g_date_set_time_t( &gdate,
+ gnc_gdate_set_time64( &gdate,
gnc_date_edit_get_date(
sxed->endDateEntry ) );
xaccSchedXactionSetEndDate( sxed->sx, &gdate );
@@ -1194,7 +1194,8 @@
/* Setup the end-date GNC widget */
{
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
- sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new( time(NULL), FALSE, FALSE ));
+ sxed->endDateEntry = GNC_DATE_EDIT(gnc_date_edit_new (gnc_time (NULL),
+ FALSE, FALSE));
gtk_widget_show(GTK_WIDGET(sxed->endDateEntry));
g_signal_connect( sxed->endDateEntry, "date-changed",
G_CALLBACK( sxed_excal_update_adapt_cb ), sxed );
@@ -1354,7 +1355,7 @@
schedXact_editor_populate( GncSxEditorDialog *sxed )
{
char *name;
- time_t tmpDate;
+ time64 tmpDate;
SplitRegister *splitReg;
struct tm *tmpTm;
const GDate *gd;
@@ -1385,11 +1386,7 @@
if ( g_date_valid( gd ) )
{
gtk_toggle_button_set_active( sxed->optEndDate, TRUE );
- /* fill in date data. */
- tmpTm = g_new0( struct tm, 1 );
- g_date_to_struct_tm( gd, tmpTm );
- tmpDate = mktime( tmpTm );
- g_free( tmpTm );
+ tmpDate = gnc_time64_get_day_start_gdate (gd);
gnc_date_edit_set_time( sxed->endDateEntry, tmpDate );
set_endgroup_toggle_states( sxed, END_DATE );
@@ -1632,7 +1629,8 @@
if (gtk_toggle_button_get_active(sxed->optEndDate))
{
GDate end_date;
- g_date_set_time_t(&end_date, gnc_date_edit_get_date(sxed->endDateEntry));
+ g_date_clear (&end_date, 1);
+ gnc_gdate_set_time64 (&end_date, gnc_date_edit_get_date(sxed->endDateEntry));
gnc_dense_cal_store_update_recurrences_date_end(sxed->dense_cal_model, &first_date, recurrences, &end_date);
}
else if (gtk_toggle_button_get_active(sxed->optEndNone))
Modified: gnucash/trunk/src/gnome/dialog-sx-from-trans.c
===================================================================
--- gnucash/trunk/src/gnome/dialog-sx-from-trans.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/dialog-sx-from-trans.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -26,6 +26,7 @@
#include "config.h"
+#include <gnc-gdate-utils.h>
#include "dialog-sx-editor.h"
#include "dialog-sx-from-trans.h"
#include "dialog-utils.h"
@@ -165,11 +166,11 @@
if (gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(sxfti->ed_but)))
{
- time_t end_tt;
+ time64 end_tt;
retval.type = END_ON_DATE;
g_date_clear( &(retval.end_date), 1 );
end_tt = gnc_date_edit_get_date(sxfti->endDateGDE);
- g_date_set_time_t( &(retval.end_date), end_tt);
+ gnc_gdate_set_time64( &(retval.end_date), end_tt);
return retval;
}
@@ -336,7 +337,7 @@
const char *transName;
gint pos;
GList *schedule = NULL;
- time_t start_tt;
+ time64 start_tt;
struct tm *tmpTm;
GDate date, nextDate;
@@ -391,8 +392,8 @@
{
GtkWidget *paramTable = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "param_table" ));
sxfti->startDateGDE =
- GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
- FALSE, FALSE ) );
+ GNC_DATE_EDIT( gnc_date_edit_new (gnc_time (NULL),
+ FALSE, FALSE));
gtk_table_attach( GTK_TABLE(paramTable),
GTK_WIDGET( sxfti->startDateGDE ),
1, 2, 2, 3,
@@ -406,8 +407,8 @@
{
GtkWidget *endDateBox = GTK_WIDGET(gtk_builder_get_object(sxfti->builder, "end_date_hbox" ));
sxfti->endDateGDE =
- GNC_DATE_EDIT( gnc_date_edit_new( time( NULL ),
- FALSE, FALSE ) );
+ GNC_DATE_EDIT( gnc_date_edit_new (gnc_time (NULL),
+ FALSE, FALSE));
gtk_box_pack_start( GTK_BOX( endDateBox ),
GTK_WIDGET( sxfti->endDateGDE ),
TRUE, TRUE, 0 );
@@ -419,7 +420,7 @@
/* Setup the initial start date for user display/confirmation */
/* compute good initial date. */
start_tt = xaccTransGetDate( sxfti->trans );
- g_date_set_time_t( &date, start_tt );
+ gnc_gdate_set_time64( &date, start_tt );
sxfti->freq_combo = GTK_COMBO_BOX(gtk_builder_get_object(sxfti->builder, "freq_combo_box"));
gtk_combo_box_set_active(GTK_COMBO_BOX(sxfti->freq_combo), 0);
g_signal_connect( sxfti->freq_combo, "changed",
@@ -428,11 +429,7 @@
sxftd_update_schedule( sxfti, &date, &schedule);
recurrenceListNextInstance(schedule, &date, &nextDate);
recurrenceListFree(&schedule);
-
- tmpTm = g_new0( struct tm, 1 );
- g_date_to_struct_tm( &nextDate, tmpTm );
- start_tt = mktime( tmpTm );
- g_free( tmpTm );
+ start_tt = gnc_time64_get_day_start_gdate (&nextDate);
gnc_date_edit_set_time( sxfti->startDateGDE, start_tt );
g_signal_connect( GTK_OBJECT(sxfti->name), "destroy",
@@ -462,7 +459,7 @@
xaccSchedXactionSetName(sx, name);
g_free(name);
- g_date_set_time_t( &date, gnc_date_edit_get_date( sxfti->startDateGDE ) );
+ gnc_gdate_set_time64( &date, gnc_date_edit_get_date( sxfti->startDateGDE ) );
sxftd_update_schedule(sxfti, &date, &schedule);
if (sxftd_errno == 0)
@@ -579,21 +576,17 @@
{
SXFromTransInfo *sxfti = (SXFromTransInfo*)user_data;
GDate date, nextDate;
- time_t tmp_tt;
+ time64 tmp_tt;
struct tm *tmpTm;
GList *schedule = NULL;
tmp_tt = xaccTransGetDate( sxfti->trans );
- g_date_set_time_t( &date, tmp_tt );
+ gnc_gdate_set_time64 (&date, tmp_tt);
g_date_clear(&nextDate, 1);
sxftd_update_schedule(sxfti, &date, &schedule);
recurrenceListNextInstance(schedule, &date, &nextDate);
-
- tmpTm = g_new0( struct tm, 1 );
- g_date_to_struct_tm( &nextDate, tmpTm );
- tmp_tt = mktime( tmpTm );
- g_free( tmpTm );
+ tmp_tt = gnc_time64_get_day_start_gdate (&nextDate);
gnc_date_edit_set_time( sxfti->startDateGDE, tmp_tt );
recurrenceListFree(&schedule);
@@ -682,7 +675,7 @@
sxftd_update_example_cal( SXFromTransInfo *sxfti )
{
struct tm *tmpTm;
- time_t tmp_tt;
+ time64 tmp_tt;
GDate date, startDate, nextDate;
GList *schedule = NULL;
getEndTuple get;
@@ -690,13 +683,7 @@
get = sxftd_get_end_info( sxfti );
tmp_tt = gnc_date_edit_get_date( sxfti->startDateGDE );
- tmpTm = g_new0( struct tm, 1 );
- *tmpTm = *localtime( &tmp_tt );
- g_date_clear(&date, 1);
- g_date_set_day( &date, tmpTm->tm_mday );
- g_date_set_month( &date, tmpTm->tm_mon + 1 );
- g_date_set_year( &date, tmpTm->tm_year + 1900 );
- g_free( tmpTm );
+ gnc_gdate_set_time64 (&date, tmp_tt);
sxftd_update_schedule(sxfti, &date, &schedule);
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -118,8 +118,8 @@
void gnc_plugin_page_register_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister *page);
void gnc_plugin_page_register_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister *page);
-static time_t gnc_plugin_page_register_filter_dmy2time (char *date_string);
-static gchar *gnc_plugin_page_register_filter_time2dmy (time_t raw_time);
+static time64 gnc_plugin_page_register_filter_dmy2time (char *date_string);
+static gchar *gnc_plugin_page_register_filter_time2dmy (time64 raw_time);
static gchar *gnc_plugin_page_register_get_filter (GncPluginPage *plugin_page);
void gnc_plugin_page_register_set_filter (GncPluginPage *plugin_page, const gchar *filter);
@@ -501,10 +501,10 @@
GtkWidget *end_date;
cleared_match_t original_cleared_match;
cleared_match_t cleared_match;
- time_t original_start_time;
- time_t original_end_time;
- time_t start_time;
- time_t end_time;
+ time64 original_start_time;
+ time64 original_end_time;
+ time64 start_time;
+ time64 end_time;
gboolean original_save_filter;
gboolean save_filter;
} fd;
@@ -942,16 +942,16 @@
{
PINFO("Loaded Filter Start Date is %s", filter[1]);
- priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time( filter[1] );
- priv->fd.start_time = gnc_timet_get_day_start(priv->fd.start_time);
+ priv->fd.start_time = gnc_plugin_page_register_filter_dmy2time (filter[1] );
+ priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
filter_changed = filter_changed + 1;
if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
{
PINFO("Loaded Filter End Date is %s", filter[2]);
- priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time( filter[2] );
- priv->fd.end_time = gnc_timet_get_day_end(priv->fd.end_time);
+ priv->fd.end_time = gnc_plugin_page_register_filter_dmy2time (filter[2] );
+ priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
filter_changed = filter_changed + 1;
}
}
@@ -1824,42 +1824,38 @@
}
-/* This function converts a time_t value date to a string */
+/* This function converts a time64 value date to a string */
static gchar *
-gnc_plugin_page_register_filter_time2dmy ( time_t raw_time)
+gnc_plugin_page_register_filter_time2dmy ( time64 raw_time)
{
struct tm * timeinfo;
gchar date_string[11];
- timeinfo = localtime ( &raw_time );
- strftime(date_string, 11, "%d-%m-%Y", timeinfo );
+ timeinfo = gnc_localtime (&raw_time);
+ strftime (date_string, 11, "%d-%m-%Y", timeinfo);
PINFO("Date string is %s", date_string);
+ gnc_tm_free (timeinfo);
return g_strdup(date_string);
}
-/* This function converts a string date to a time_t value */
-static time_t
-gnc_plugin_page_register_filter_dmy2time ( char *date_string)
+/* This function converts a string date to a time64 value */
+static time64
+gnc_plugin_page_register_filter_dmy2time (char *date_string)
{
- struct tm *when;
- gint yy = 0, mm = 0, dd = 0;
+ struct tm when;
- time_t raw_time;
-
PINFO("Date string is %s", date_string);
+ memset (&when, 0, sizeof (when));
- sscanf(date_string, "%d-%d-%d", &dd, &mm, &yy );
+ sscanf (date_string, "%d-%d-%d", &when.tm_mday,
+ &when.tm_mon, &when.tm_year);
- time(&raw_time);
- when = localtime ( &raw_time );
+ when.tm_mon -= 1;
+ when.tm_year -= 1900;
- when->tm_year = yy - 1900;
- when->tm_mon = mm - 1 ;
- when->tm_mday = dd;
-
- return mktime(when);
+ return gnc_mktime (&when);
}
@@ -1963,20 +1959,20 @@
get_filter_times(GncPluginPageRegister *page)
{
GncPluginPageRegisterPrivate *priv;
- time_t time_val;
+ time64 time_val;
priv = GNC_PLUGIN_PAGE_REGISTER_GET_PRIVATE(page);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
{
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
- time_val = gnc_timet_get_day_start(time_val);
+ time_val = gnc_time64_get_day_start(time_val);
priv->fd.start_time = time_val;
}
else
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
{
- priv->fd.start_time = gnc_timet_get_today_start();
+ priv->fd.start_time = gnc_time64_get_today_start();
}
else
{
@@ -1987,14 +1983,14 @@
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
{
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
- time_val = gnc_timet_get_day_end(time_val);
+ time_val = gnc_time64_get_day_end(time_val);
priv->fd.end_time = time_val;
}
else
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
{
- priv->fd.end_time = gnc_timet_get_today_end();
+ priv->fd.end_time = gnc_time64_get_today_end();
}
else
{
@@ -2738,8 +2734,8 @@
new_trans = xaccTransReverse(trans);
/* Clear transaction level info */
- xaccTransSetDatePostedSecs(new_trans, time(NULL));
- xaccTransSetDateEnteredSecs(new_trans, time(NULL));
+ xaccTransSetDatePostedSecs (new_trans, gnc_time (NULL));
+ xaccTransSetDateEnteredSecs (new_trans, gnc_time (NULL));
qof_event_resume();
@@ -2841,7 +2837,7 @@
{
GncPluginPageRegisterPrivate *priv;
GtkWidget *dialog, *toggle, *button, *table, *hbox;
- time_t start_time, end_time, time_val;
+ time64 start_time, end_time, time_val;
GtkBuilder *builder;
gboolean sensitive, value;
Query *query;
@@ -2918,8 +2914,8 @@
else
{
time_val = start_time;
- if ((start_time >= gnc_timet_get_today_start()) &&
- (start_time <= gnc_timet_get_today_end()))
+ if ((start_time >= gnc_time64_get_today_start()) &&
+ (start_time <= gnc_time64_get_today_end()))
{
button = priv->fd.start_date_today;
sensitive = FALSE;
@@ -2931,12 +2927,12 @@
}
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
- priv->fd.start_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+ priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
gtk_widget_show (priv->fd.start_date);
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
- gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.start_date), time_val);
+ gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
page);
@@ -2953,8 +2949,8 @@
else
{
time_val = end_time;
- if ((end_time >= gnc_timet_get_today_start()) &&
- (end_time <= gnc_timet_get_today_end()))
+ if ((end_time >= gnc_time64_get_today_start()) &&
+ (end_time <= gnc_time64_get_today_end()))
{
button = priv->fd.end_date_today;
sensitive = FALSE;
@@ -2966,12 +2962,12 @@
}
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
- priv->fd.end_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+ priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
gtk_widget_show (priv->fd.end_date);
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
- gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.end_date), time_val);
+ gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
G_CALLBACK (gnc_plugin_page_register_filter_gde_changed_cb),
page);
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-register2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-register2.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-register2.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -120,8 +120,8 @@
void gnc_plugin_page_register2_filter_status_one_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
void gnc_plugin_page_register2_filter_save_cb(GtkToggleButton *button, GncPluginPageRegister2 *page);
-static time_t gnc_plugin_page_register2_filter_dmy2time (char *date_string);
-static gchar *gnc_plugin_page_register2_filter_time2dmy (time_t raw_time);
+static time64 gnc_plugin_page_register2_filter_dmy2time (char *date_string);
+static gchar *gnc_plugin_page_register2_filter_time2dmy (time64 raw_time);
static gchar *gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page);
void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter);
@@ -503,10 +503,10 @@
GtkWidget *end_date;
cleared_match_t original_cleared_match;
cleared_match_t cleared_match;
- time_t original_start_time;
- time_t original_end_time;
- time_t start_time;
- time_t end_time;
+ time64 original_start_time;
+ time64 original_end_time;
+ time64 start_time;
+ time64 end_time;
gboolean original_save_filter;
gboolean save_filter;
} fd;
@@ -977,16 +977,16 @@
{
PINFO("Loaded Filter Start Date is %s", filter[1]);
- priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time( filter[1] );
- priv->fd.start_time = gnc_timet_get_day_start(priv->fd.start_time);
+ priv->fd.start_time = gnc_plugin_page_register2_filter_dmy2time ( filter[1] );
+ priv->fd.start_time = gnc_time64_get_day_start(priv->fd.start_time);
filter_changed = filter_changed + 1;
if (filter[2] && (g_strcmp0 (filter[2], "0") != 0 ))
{
PINFO("Loaded Filter End Date is %s", filter[2]);
- priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time( filter[2] );
- priv->fd.end_time = gnc_timet_get_day_end(priv->fd.end_time);
+ priv->fd.end_time = gnc_plugin_page_register2_filter_dmy2time ( filter[2] );
+ priv->fd.end_time = gnc_time64_get_day_end(priv->fd.end_time);
filter_changed = filter_changed + 1;
}
}
@@ -1884,43 +1884,38 @@
}
-/* This function converts a time_t value date to a string */
+/* This function converts a time64 value date to a string */
static gchar *
-gnc_plugin_page_register2_filter_time2dmy ( time_t raw_time)
+gnc_plugin_page_register2_filter_time2dmy ( time64 raw_time)
{
struct tm * timeinfo;
gchar date_string[11];
gint i;
- timeinfo = localtime ( &raw_time );
- i = strftime(date_string, 11, "%d-%m-%Y", timeinfo );
+ timeinfo = gnc_localtime ( &raw_time );
+ i = strftime (date_string, 11, "%d-%m-%Y", timeinfo );
PINFO("Date string is %s", date_string);
+ gnc_tm_free (timeinfo);
return g_strdup(date_string);
}
-/* This function converts a string date to a time_t value */
-static time_t
+/* This function converts a string date to a time64 value */
+static time64
gnc_plugin_page_register2_filter_dmy2time ( char *date_string)
{
- struct tm *when;
- gint yy = 0, mm = 0, dd = 0;
+ struct tm when;
- time_t raw_time;
-
PINFO("Date string is %s", date_string);
+ memset (&when, 0, sizeof (when));
+ sscanf(date_string, "%d-%d-%d", &when.tm_mday,
+ &when.tm_mon, &when.tm_year );
- sscanf(date_string, "%d-%d-%d", &dd, &mm, &yy );
+ when.tm_year -= 1900;
+ when.tm_mon -= 1 ;
- time(&raw_time);
- when = localtime ( &raw_time );
-
- when->tm_year = yy - 1900;
- when->tm_mon = mm - 1 ;
- when->tm_mday = dd;
-
- return mktime(when);
+ return gnc_mktime (&when);
}
@@ -2025,20 +2020,20 @@
{
GncPluginPageRegister2Private *priv;
GtkWidget *button, *today, *gde;
- time_t time_val;
+ time64 time_val;
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_choose)))
{
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.start_date));
- time_val = gnc_timet_get_day_start(time_val);
+ time_val = gnc_time64_get_day_start(time_val);
priv->fd.start_time = time_val;
}
else
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
{
- priv->fd.start_time = gnc_timet_get_today_start();
+ priv->fd.start_time = gnc_time64_get_today_start();
}
else
{
@@ -2049,14 +2044,14 @@
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.end_date_choose)))
{
time_val = gnc_date_edit_get_date(GNC_DATE_EDIT(priv->fd.end_date));
- time_val = gnc_timet_get_day_end(time_val);
+ time_val = gnc_time64_get_day_end(time_val);
priv->fd.end_time = time_val;
}
else
{
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->fd.start_date_today)))
{
- priv->fd.end_time = gnc_timet_get_today_end();
+ priv->fd.end_time = gnc_time64_get_today_end();
}
else
{
@@ -2803,8 +2798,8 @@
new_trans = xaccTransReverse(trans);
/* Clear transaction level info */
- xaccTransSetDatePostedSecs(new_trans, time(NULL));
- xaccTransSetDateEnteredSecs(new_trans, time(NULL));
+ xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
+ xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
qof_event_resume();
@@ -2907,7 +2902,7 @@
{
GncPluginPageRegister2Private *priv;
GtkWidget *dialog, *toggle, *button, *start_date, *end_date, *table, *hbox;
- time_t start_time, end_time, time_val;
+ time64 start_time, end_time, time_val;
GtkBuilder *builder;
gboolean sensitive, value;
Query *query;
@@ -2984,8 +2979,8 @@
else
{
time_val = start_time;
- if ((start_time >= gnc_timet_get_today_start()) &&
- (start_time <= gnc_timet_get_today_end()))
+ if ((start_time >= gnc_time64_get_today_start()) &&
+ (start_time <= gnc_time64_get_today_end()))
{
button = priv->fd.start_date_today;
sensitive = FALSE;
@@ -2997,12 +2992,12 @@
}
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
- priv->fd.start_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+ priv->fd.start_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "start_date_hbox"));
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.start_date, TRUE, TRUE, 0);
gtk_widget_show (priv->fd.start_date);
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.start_date), sensitive);
- gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.start_date), time_val);
+ gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.start_date), time_val);
g_signal_connect (G_OBJECT (priv->fd.start_date), "date-changed",
G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
page);
@@ -3019,8 +3014,8 @@
else
{
time_val = end_time;
- if ((end_time >= gnc_timet_get_today_start()) &&
- (end_time <= gnc_timet_get_today_end()))
+ if ((end_time >= gnc_time64_get_today_start()) &&
+ (end_time <= gnc_time64_get_today_end()))
{
button = priv->fd.end_date_today;
sensitive = FALSE;
@@ -3032,12 +3027,12 @@
}
}
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
- priv->fd.end_date = gnc_date_edit_new (time (NULL), FALSE, FALSE);
+ priv->fd.end_date = gnc_date_edit_new (gnc_time (NULL), FALSE, FALSE);
hbox = GTK_WIDGET(gtk_builder_get_object (builder, "end_date_hbox"));
gtk_box_pack_start (GTK_BOX (hbox), priv->fd.end_date, TRUE, TRUE, 0);
gtk_widget_show (priv->fd.end_date);
gtk_widget_set_sensitive(GTK_WIDGET(priv->fd.end_date), sensitive);
- gnc_date_edit_set_time(GNC_DATE_EDIT(priv->fd.end_date), time_val);
+ gnc_date_edit_set_time (GNC_DATE_EDIT(priv->fd.end_date), time_val);
g_signal_connect (G_OBJECT (priv->fd.end_date), "date-changed",
G_CALLBACK (gnc_plugin_page_register2_filter_gde_changed_cb),
page);
Modified: gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-sx-list.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -46,6 +46,8 @@
#include <gtk/gtk.h>
#include <glib.h>
#include <glib/gi18n.h>
+
+#include <gnc-gdate-utils.h>
#include "SX-book.h"
#include "Split.h"
#include "Transaction.h"
@@ -363,7 +365,7 @@
{
GDate end;
g_date_clear(&end, 1);
- g_date_set_time_t(&end, time(NULL));
+ gnc_gdate_set_today (&end);
g_date_add_years(&end, 1);
priv->instances = GNC_SX_INSTANCE_MODEL(gnc_sx_get_instances(&end, TRUE));
}
@@ -551,7 +553,7 @@
GList *schedule;
g_date_clear(&now, 1);
- g_date_set_time_t(&now, time(NULL));
+ gnc_gdate_set_today (&now);
recurrenceSet(r, 1, PERIOD_MONTH, &now, WEEKEND_ADJ_NONE);
schedule = gnc_sx_get_schedule(new_sx);
schedule = g_list_append(schedule, r);
Modified: gnucash/trunk/src/gnome/gnc-split-reg.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-split-reg.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -88,7 +88,7 @@
static void gnc_split_reg_ld_destroy( GNCLedgerDisplay *ledger );
static Transaction* create_balancing_transaction(QofBook *book, Account *account,
- time_t statement_date, gnc_numeric balancing_amount);
+ time64 statement_date, gnc_numeric balancing_amount);
void gsr_default_enter_handler ( GNCSplitReg *w, gpointer ud );
void gsr_default_cancel_handler ( GNCSplitReg *w, gpointer ud );
@@ -111,7 +111,7 @@
static void gsr_emit_simple_signal( GNCSplitReg *gsr, const char *sigName );
static void gsr_emit_help_changed( GnucashRegister *reg, gpointer user_data );
-static void gsr_emit_include_date_signal( GNCSplitReg *gsr, time_t date );
+static void gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date );
void gnc_split_reg_cut_cb(GtkWidget *w, gpointer data);
void gnc_split_reg_copy_cb(GtkWidget *w, gpointer data);
@@ -284,7 +284,7 @@
G_SIGNAL_RUN_LAST,
signals[i++].defaultOffset,
NULL, NULL,
- g_cclosure_marshal_VOID__INT, /* time_t == int */
+ g_cclosure_marshal_VOID__INT, /* time64 == int */
G_TYPE_NONE, 1, G_TYPE_INT );
g_assert( i == LAST_SIGNAL );
@@ -897,8 +897,8 @@
new_trans = xaccTransReverse(trans);
/* Clear transaction level info */
- xaccTransSetDatePostedSecs(new_trans, time(NULL));
- xaccTransSetDateEnteredSecs(new_trans, time(NULL));
+ xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
+ xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
/* Now jump to new trans */
gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
@@ -1409,7 +1409,7 @@
void
gnc_split_reg_balancing_entry(GNCSplitReg *gsr, Account *account,
- time_t statement_date, gnc_numeric balancing_amount)
+ time64 statement_date, gnc_numeric balancing_amount)
{
Transaction *transaction;
@@ -1436,7 +1436,7 @@
static Transaction*
create_balancing_transaction(QofBook *book, Account *account,
- time_t statement_date, gnc_numeric balancing_amount)
+ time64 statement_date, gnc_numeric balancing_amount)
{
Transaction *trans;
@@ -2070,7 +2070,7 @@
static
void
-gsr_emit_include_date_signal( GNCSplitReg *gsr, time_t date )
+gsr_emit_include_date_signal( GNCSplitReg *gsr, time64 date )
{
g_signal_emit_by_name( gsr, "include-date", date, NULL );
}
Modified: gnucash/trunk/src/gnome/gnc-split-reg.h
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg.h 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-split-reg.h 2012-12-01 22:45:49 UTC (rev 22626)
@@ -111,7 +111,7 @@
void (*unvoid_txn_cb) ( GNCSplitReg *w, gpointer user_data );
void (*reverse_txn_cb) ( GNCSplitReg *w, gpointer user_data );
void (*help_changed_cb) ( GNCSplitReg *w, gpointer user_data );
- void (*include_date_cb) ( GNCSplitReg *w, time_t date, gpointer user_data );
+ void (*include_date_cb) ( GNCSplitReg *w, time64 date, gpointer user_data );
};
typedef enum
@@ -231,7 +231,7 @@
* window.
*/
void gnc_split_reg_balancing_entry (GNCSplitReg *gsr, Account *account,
- time_t statement_date, gnc_numeric balancing_amount);
+ time64 statement_date, gnc_numeric balancing_amount);
void gsr_default_delete_handler( GNCSplitReg *gsr, gpointer data );
void gnc_split_reg_enter( GNCSplitReg *gsr, gboolean next_transaction );
Modified: gnucash/trunk/src/gnome/gnc-split-reg2.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg2.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-split-reg2.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -97,7 +97,7 @@
static void gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger );
static Transaction* create_balancing_transaction(QofBook *book, Account *account,
- time_t statement_date, gnc_numeric balancing_amount);
+ time64 statement_date, gnc_numeric balancing_amount);
void gsr2_default_enter_handler ( GNCSplitReg2 *w, gpointer ud );
void gsr2_default_cancel_handler ( GNCSplitReg2 *w, gpointer ud );
@@ -120,7 +120,7 @@
static void gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName );
static void gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data);
-static void gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time_t date );
+static void gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date );
void gnc_split_reg2_cut_cb(GtkWidget *w, gpointer data);
void gnc_split_reg2_copy_cb(GtkWidget *w, gpointer data);
@@ -295,7 +295,7 @@
G_SIGNAL_RUN_LAST,
signals[i++].defaultOffset,
NULL, NULL,
- g_cclosure_marshal_VOID__INT, /* time_t == int */
+ g_cclosure_marshal_VOID__INT, /* time64 == int */
G_TYPE_NONE, 1, G_TYPE_INT );
g_assert( i == LAST_SIGNAL );
@@ -975,8 +975,8 @@
new_trans = xaccTransReverse(trans);
/* Clear transaction level info */
- xaccTransSetDatePostedSecs(new_trans, time(NULL));
- xaccTransSetDateEnteredSecs(new_trans, time(NULL));
+ xaccTransSetDatePostedSecs(new_trans, gnc_time (NULL));
+ xaccTransSetDateEnteredSecs(new_trans, gnc_time (NULL));
/* Now jump to new trans */
gnc_split_reg2_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
@@ -1479,7 +1479,7 @@
void
gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
- time_t statement_date, gnc_numeric balancing_amount)
+ time64 statement_date, gnc_numeric balancing_amount)
{
/*FIXME*/
#ifdef skip
@@ -1508,7 +1508,7 @@
static Transaction*
create_balancing_transaction(QofBook *book, Account *account,
- time_t statement_date, gnc_numeric balancing_amount)
+ time64 statement_date, gnc_numeric balancing_amount)
{
/*FIXME*/
#ifdef skip
@@ -2171,7 +2171,7 @@
static
void
-gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time_t date )
+gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date )
{
g_signal_emit_by_name( gsr, "include-date", date, NULL );
}
Modified: gnucash/trunk/src/gnome/gnc-split-reg2.h
===================================================================
--- gnucash/trunk/src/gnome/gnc-split-reg2.h 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/gnc-split-reg2.h 2012-12-01 22:45:49 UTC (rev 22626)
@@ -114,7 +114,7 @@
void (*unvoid_txn_cb) ( GNCSplitReg2 *w, gpointer user_data );
void (*reverse_txn_cb) ( GNCSplitReg2 *w, gpointer user_data );
void (*help_changed_cb) ( GNCSplitReg2 *w, gpointer user_data );
- void (*include_date_cb) ( GNCSplitReg2 *w, time_t date, gpointer user_data );
+ void (*include_date_cb) ( GNCSplitReg2 *w, time64 date, gpointer user_data );
};
#ifdef skip // Coming from original gnc-split-reg.h
@@ -243,7 +243,7 @@
* window.
*/
void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
- time_t statement_date, gnc_numeric balancing_amount);
+ time64 statement_date, gnc_numeric balancing_amount);
void gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data );
void gnc_split_reg2_enter (GNCSplitReg2 *gsr, gboolean next_transaction );
Modified: gnucash/trunk/src/gnome/reconcile-view.c
===================================================================
--- gnucash/trunk/src/gnome/reconcile-view.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/reconcile-view.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -137,7 +137,7 @@
GtkWidget *
gnc_reconcile_view_new (Account *account, GNCReconcileViewType type,
- time_t statement_date)
+ time64 statement_date)
{
GNCReconcileView *view;
GtkListStore *liststore;
@@ -203,14 +203,14 @@
{
Split *split = splits->data;
char recn = xaccSplitGetReconcile (split);
- time_t trans_date = xaccTransGetDate (xaccSplitGetParent (split));
+ time64 trans_date = xaccTransGetDate (xaccSplitGetParent (split));
/* Just an extra verification that our query is correct ;) */
g_assert (recn == NREC || recn == CREC);
if (recn == CREC &&
- difftime (trans_date, statement_date) <= 0)
- g_hash_table_insert (view->reconciled, split, split);
+ gnc_difftime (trans_date, statement_date) <= 0)
+ g_hash_table_insert (view->reconciled, split, split);
}
}
@@ -706,14 +706,14 @@
grv_commit_hash_helper (gpointer key, gpointer value, gpointer user_data)
{
Split *split = key;
- time_t *date = user_data;
+ time64 *date = user_data;
xaccSplitSetReconcile (split, YREC);
xaccSplitSetDateReconciledSecs (split, *date);
}
void
-gnc_reconcile_view_commit (GNCReconcileView *view, time_t date)
+gnc_reconcile_view_commit (GNCReconcileView *view, time64 date)
{
g_return_if_fail (view != NULL);
g_return_if_fail (GNC_IS_RECONCILE_VIEW (view));
@@ -764,8 +764,8 @@
// Don't change splits past reconciliation date that haven't been
// set to be reconciled
- if ( difftime(view->statement_date,
- xaccTransGetDate (xaccSplitGetParent (entry))) >= 0 ||
+ if (gnc_difftime (view->statement_date,
+ xaccTransGetDate (xaccSplitGetParent (entry))) >= 0 ||
g_hash_table_lookup (view->reconciled, entry))
{
recn = g_hash_table_lookup (view->reconciled, entry) ? CREC : NREC;
Modified: gnucash/trunk/src/gnome/reconcile-view.h
===================================================================
--- gnucash/trunk/src/gnome/reconcile-view.h 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/reconcile-view.h 2012-12-01 22:45:49 UTC (rev 22626)
@@ -52,7 +52,7 @@
Account *account;
GList *column_list;
- time_t statement_date;
+ time64 statement_date;
GNCReconcileView *sibling;
GNCReconcileViewType view_type;
@@ -78,7 +78,7 @@
GtkWidget * gnc_reconcile_view_new (Account * account,
GNCReconcileViewType type,
- time_t date);
+ time64 date);
gint gnc_reconcile_view_get_num_splits (GNCReconcileView *view);
@@ -92,7 +92,7 @@
gnc_numeric gnc_reconcile_view_reconciled_balance (GNCReconcileView *view);
-void gnc_reconcile_view_commit (GNCReconcileView *view, time_t date);
+void gnc_reconcile_view_commit (GNCReconcileView *view, time64 date);
void gnc_reconcile_view_postpone (GNCReconcileView *view);
Modified: gnucash/trunk/src/gnome/window-reconcile.c
===================================================================
--- gnucash/trunk/src/gnome/window-reconcile.c 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/window-reconcile.c 2012-12-01 22:45:49 UTC (rev 22626)
@@ -48,6 +48,7 @@
#include "gnc-event.h"
#include "gnc-filepath-utils.h"
#include "gnc-gconf-utils.h"
+#include <gnc-gdate-utils.h>
#include "gnc-gnome-utils.h"
#include "gnc-main-window.h"
#include "gnc-plugin-page-register.h"
@@ -66,7 +67,7 @@
{
GncGUID account; /* The account that we are reconciling */
gnc_numeric new_ending; /* The new ending balance */
- time_t statement_date; /* The statement date */
+ time64 statement_date; /* The statement date */
gint component_id; /* id of component */
@@ -117,7 +118,7 @@
XferDialog *xferData; /* the interest xfer dialog (if it exists) */
gboolean include_children;
- time_t date; /* the interest xfer reconcile date */
+ time64 date; /* the interest xfer reconcile date */
} startRecnWindowData;
@@ -162,7 +163,7 @@
/* This static indicates the debugging module that this .o belongs to. */
G_GNUC_UNUSED static QofLogModule log_module = GNC_MOD_GUI;
-static time_t gnc_reconcile_last_statement_date = 0;
+static time64 gnc_reconcile_last_statement_date = 0;
/** IMPLEMENTATIONS *************************************************/
@@ -342,7 +343,7 @@
{
GNCDateEdit *gde = GNC_DATE_EDIT (widget);
gnc_numeric new_balance;
- time_t new_date;
+ time64 new_date;
if (data->user_set_value)
return;
@@ -584,9 +585,9 @@
static void
-gnc_save_reconcile_interval(Account *account, time_t statement_date)
+gnc_save_reconcile_interval(Account *account, time64 statement_date)
{
- time_t prev_statement_date;
+ time64 prev_statement_date;
int days = 0, months = 0;
double seconds;
@@ -596,7 +597,7 @@
/*
* Compute the number of days difference.
*/
- seconds = difftime(statement_date, prev_statement_date);
+ seconds = gnc_difftime (statement_date, prev_statement_date);
days = (int)(seconds / 60 / 60 / 24);
/*
@@ -619,8 +620,8 @@
{
struct tm current, prev;
- current = * localtime(&statement_date);
- prev = * localtime(&prev_statement_date);
+ gnc_localtime_r (&statement_date, ¤t);
+ gnc_localtime_r (&prev_statement_date, &prev);
months = ((12 * current.tm_year + current.tm_mon) -
(12 * prev.tm_year + prev.tm_mon));
days = 0;
@@ -649,7 +650,7 @@
\********************************************************************/
static gboolean
startRecnWindow(GtkWidget *parent, Account *account,
- gnc_numeric *new_ending, time_t *statement_date,
+ gnc_numeric *new_ending, time64 *statement_date,
gboolean enable_subaccount)
{
GtkWidget *dialog, *end_value, *date_value, *include_children_button;
@@ -1182,7 +1183,7 @@
RecnWindow *recnData = data;
Account *account = recn_get_account (recnData);
gnc_numeric new_ending = recnData->new_ending;
- time_t statement_date = recnData->statement_date;
+ time64 statement_date = recnData->statement_date;
if (gnc_reverse_balance (account))
new_ending = gnc_numeric_neg (new_ending);
@@ -1203,7 +1204,7 @@
GNCSplitReg *gsr;
Account *account;
gnc_numeric balancing_amount;
- time_t statement_date;
+ time64 statement_date;
gsr = gnc_reconcile_window_open_register(recnData);
@@ -1220,7 +1221,7 @@
statement_date = recnData->statement_date;
if (statement_date == 0)
- statement_date = time(NULL); // default to 'now'
+ statement_date = gnc_time (NULL); // default to 'now'
gnc_split_reg_balancing_entry(gsr, account, statement_date, balancing_amount);
}
@@ -1434,11 +1435,11 @@
static void
gnc_get_reconcile_info (Account *account,
gnc_numeric *new_ending,
- time_t *statement_date)
+ time64 *statement_date)
{
gboolean always_today;
GDate date;
- time_t today;
+ time64 today;
struct tm tm;
g_date_clear(&date, 1);
@@ -1451,7 +1452,7 @@
{
int months = 1, days = 0;
- g_date_set_time_t(&date, *statement_date);
+ gnc_gdate_set_time64(&date, *statement_date);
xaccAccountGetReconcileLastInterval (account, &months, &days);
@@ -1464,20 +1465,18 @@
/* Track last day of the month, i.e. 1/31 -> 2/28 -> 3/31 */
if (was_last_day_of_month)
{
- g_date_set_day(&date, g_date_get_days_in_month(g_date_get_month(&date),
- g_date_get_year(&date)));
+ g_date_set_day (&date, g_date_get_days_in_month(g_date_get_month(&date),
+ g_date_get_year( &date)));
}
}
else
{
- g_date_add_days(&date, days);
+ g_date_add_days (&date, days);
}
- g_date_to_struct_tm(&date, &tm);
- gnc_tm_set_day_end (&tm);
- *statement_date = mktime (&tm);
+ *statement_date = gnc_time64_get_day_end_gdate (&date);
- today = gnc_timet_get_day_end(time(NULL));
+ today = gnc_time64_get_day_end (gnc_time (NULL));
if (*statement_date > today)
*statement_date = today;
}
@@ -1630,7 +1629,7 @@
recnWindow (GtkWidget *parent, Account *account)
{
gnc_numeric new_ending;
- time_t statement_date;
+ time64 statement_date;
if (account == NULL)
return NULL;
@@ -1641,7 +1640,7 @@
* statements are issued at the same time, like multiple bank
* accounts on a single statement. */
if (!gnc_reconcile_last_statement_date)
- statement_date = time (NULL);
+ statement_date = gnc_time (NULL);
else
statement_date = gnc_reconcile_last_statement_date;
@@ -1680,7 +1679,7 @@
\********************************************************************/
RecnWindow *
recnWindowWithBalance (GtkWidget *parent, Account *account,
- gnc_numeric new_ending, time_t statement_date)
+ gnc_numeric new_ending, time64 statement_date)
{
RecnWindow *recnData;
GtkWidget *statusbar;
@@ -2098,7 +2097,7 @@
{
gboolean auto_payment;
Account *account;
- time_t date;
+ time64 date;
if (!gnc_numeric_zero_p (recnRecalculateBalance(recnData)))
{
Modified: gnucash/trunk/src/gnome/window-reconcile.h
===================================================================
--- gnucash/trunk/src/gnome/window-reconcile.h 2012-12-01 22:45:34 UTC (rev 22625)
+++ gnucash/trunk/src/gnome/window-reconcile.h 2012-12-01 22:45:49 UTC (rev 22626)
@@ -61,7 +61,7 @@
RecnWindow *recnWindowWithBalance (GtkWidget *parent,
Account *account,
gnc_numeric new_ending,
- time_t statement_date);
+ time64 statement_date);
void gnc_ui_reconcile_window_raise(RecnWindow * recnData);
More information about the gnucash-changes
mailing list