mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-09-03 20:53:02 -05:00
Convert all time_t to time64: register
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22627 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -406,7 +406,7 @@ GNCLedgerDisplay *
|
||||
gnc_ledger_display_gl (void)
|
||||
{
|
||||
Query *query;
|
||||
time_t start;
|
||||
time64 start;
|
||||
struct tm tm;
|
||||
GNCLedgerDisplay *ld;
|
||||
|
||||
@@ -436,7 +436,7 @@ gnc_ledger_display_gl (void)
|
||||
|
||||
gnc_tm_get_today_start(&tm);
|
||||
tm.tm_mon--; /* Default the register to the last month's worth of transactions. */
|
||||
start = mktime (&tm);
|
||||
start = gnc_mktime (&tm);
|
||||
xaccQueryAddDateMatchTT (query,
|
||||
TRUE, start,
|
||||
FALSE, 0,
|
||||
|
||||
@@ -430,7 +430,7 @@ GNCLedgerDisplay2 *
|
||||
gnc_ledger_display2_gl (void)
|
||||
{
|
||||
Query *query;
|
||||
time_t start;
|
||||
time64 start;
|
||||
struct tm tm;
|
||||
GNCLedgerDisplay2 *ld;
|
||||
|
||||
@@ -460,7 +460,7 @@ gnc_ledger_display2_gl (void)
|
||||
|
||||
gnc_tm_get_today_start(&tm);
|
||||
tm.tm_mon--; /* Default the register to the last month's worth of transactions. */
|
||||
start = mktime (&tm);
|
||||
start = gnc_mktime (&tm);
|
||||
xaccQueryAddDateMatchTT (query,
|
||||
TRUE, start,
|
||||
FALSE, 0,
|
||||
|
||||
@@ -1178,7 +1178,7 @@ gnc_split_register_get_cell_date (SplitRegister *reg, const char *cell_name)
|
||||
if (cell)
|
||||
gnc_date_cell_get_date (cell, &ts);
|
||||
else
|
||||
timespecFromTime_t (&ts, time (NULL));
|
||||
timespecFromTime64 (&ts, gnc_time (NULL));
|
||||
|
||||
return ts;
|
||||
}
|
||||
@@ -1239,7 +1239,7 @@ gnc_split_register_xfer_dialog(SplitRegister *reg, Transaction *txn,
|
||||
{
|
||||
Timespec ts;
|
||||
gnc_date_cell_get_date((DateCell*) cell, &ts);
|
||||
gnc_xfer_dialog_set_date(xfer, timespecToTime_t(ts));
|
||||
gnc_xfer_dialog_set_date(xfer, timespecToTime64(ts));
|
||||
}
|
||||
else
|
||||
gnc_xfer_dialog_set_date(xfer, xaccTransGetDate(txn));
|
||||
|
||||
@@ -277,7 +277,7 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
int new_trans_split_row = -1;
|
||||
int new_trans_row = -1;
|
||||
int new_split_row = -1;
|
||||
time_t present, autoreadonly_time = 0;
|
||||
time64 present, autoreadonly_time = 0;
|
||||
|
||||
g_return_if_fail(reg);
|
||||
table = reg->table;
|
||||
@@ -433,12 +433,12 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
vcell_loc.virt_row++;
|
||||
|
||||
/* get the current time and reset the dividing row */
|
||||
present = gnc_timet_get_today_end ();
|
||||
present = gnc_time64_get_today_end ();
|
||||
if (use_autoreadonly)
|
||||
{
|
||||
GDate *d = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
|
||||
// "d" is NULL if use_autoreadonly is FALSE
|
||||
autoreadonly_time = d ? timespecToTime_t(gdate_to_timespec(*d)) : 0;
|
||||
autoreadonly_time = d ? timespecToTime64(gdate_to_timespec(*d)) : 0;
|
||||
g_date_free(d);
|
||||
}
|
||||
|
||||
|
||||
@@ -881,7 +881,7 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
|
||||
char string[1024];
|
||||
struct tm *tm;
|
||||
Timespec ts;
|
||||
time_t tt;
|
||||
time64 tt;
|
||||
|
||||
cell = gnc_table_get_cell (reg->table, virt_loc);
|
||||
if (!cell || !cell->value || *cell->value == '\0')
|
||||
@@ -890,7 +890,7 @@ gnc_split_register_get_date_help (VirtualLocation virt_loc,
|
||||
gnc_date_cell_get_date ((DateCell *) cell, &ts);
|
||||
tt = ts.tv_sec;
|
||||
|
||||
tm = localtime (&tt);
|
||||
tm = gnc_localtime (&tt);
|
||||
|
||||
qof_strftime (string, sizeof (string), "%A %d %B %Y", tm);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ struct sr_info
|
||||
GncGUID default_account;
|
||||
|
||||
/* The last date recorded in the blank split */
|
||||
time_t last_date_entered;
|
||||
time64 last_date_entered;
|
||||
|
||||
/* true if the current blank split has been edited and commited */
|
||||
gboolean blank_split_edited;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "pricecell.h"
|
||||
#include "split-register-p.h"
|
||||
|
||||
@@ -51,7 +52,7 @@ gnc_split_register_init_info (SplitRegister *reg)
|
||||
info->default_account = *guid_null ();
|
||||
info->template_account = *guid_null ();
|
||||
|
||||
info->last_date_entered = gnc_timet_get_today_start ();
|
||||
info->last_date_entered = gnc_time64_get_today_start ();
|
||||
|
||||
info->first_pass = TRUE;
|
||||
info->full_refresh = TRUE;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <libguile.h>
|
||||
|
||||
#include <gnc-gdate-utils.h>
|
||||
#include "combocell.h"
|
||||
#include "datecell.h"
|
||||
#include "dialog-utils.h"
|
||||
@@ -508,7 +509,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
|
||||
int split_index;
|
||||
const char *in_num = NULL;
|
||||
char *out_num;
|
||||
time_t date;
|
||||
time64 date;
|
||||
gboolean use_autoreadonly = qof_book_uses_autoreadonly(gnc_get_current_book());
|
||||
|
||||
/* We are on a transaction row. Copy the whole transaction. */
|
||||
@@ -536,7 +537,7 @@ gnc_split_register_duplicate_current (SplitRegister *reg)
|
||||
{
|
||||
GDate d;
|
||||
GDate *readonly_threshold = qof_book_get_autoreadonly_gdate(gnc_get_current_book());
|
||||
g_date_set_time_t (&d, date);
|
||||
gnc_gdate_set_time64 (&d, date);
|
||||
if (g_date_compare(&d, readonly_threshold) < 0)
|
||||
{
|
||||
GtkWidget *dialog = gtk_message_dialog_new(NULL,
|
||||
@@ -1633,7 +1634,7 @@ gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
|
||||
account = gnc_split_register_get_default_account(reg);
|
||||
if (account)
|
||||
xaccSplitSetAccount(blank_split, account);
|
||||
xaccTransSetDateEnteredSecs(trans, time(NULL));
|
||||
xaccTransSetDateEnteredSecs(trans, gnc_time (NULL));
|
||||
}
|
||||
|
||||
if (split == NULL)
|
||||
|
||||
@@ -111,7 +111,7 @@ BasicCell * gnc_date_cell_new (void);
|
||||
/* days are 1-31, mon is 1-12, year 1900 == 1900 */
|
||||
void gnc_date_cell_set_value (DateCell *cell,
|
||||
int day, int mon, int year);
|
||||
void gnc_date_cell_set_value_secs (DateCell *cell, time_t secs);
|
||||
void gnc_date_cell_set_value_secs (DateCell *cell, time64 secs);
|
||||
|
||||
void gnc_date_cell_commit (DateCell *cell);
|
||||
|
||||
|
||||
@@ -138,9 +138,9 @@ gnc_parse_date (struct tm *parsed, const char * datestr)
|
||||
parsed->tm_year = year - 1900;
|
||||
|
||||
gnc_tm_set_day_start(parsed);
|
||||
if (mktime (parsed) == -1)
|
||||
if (gnc_mktime (parsed) == -1)
|
||||
gnc_tm_get_today_start (parsed);
|
||||
mktime (parsed);
|
||||
gnc_mktime (parsed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -158,7 +158,7 @@ static void
|
||||
gnc_date_cell_init (DateCell *cell)
|
||||
{
|
||||
PopBox *box;
|
||||
time_t secs;
|
||||
time64 secs;
|
||||
char buff[DATE_BUF];
|
||||
|
||||
gnc_basic_cell_init (&(cell->cell));
|
||||
@@ -186,8 +186,8 @@ gnc_date_cell_init (DateCell *cell)
|
||||
cell->cell.gui_private = box;
|
||||
|
||||
/* default value is today's date */
|
||||
time (&secs);
|
||||
box->date = *localtime (&secs);
|
||||
gnc_time (&secs);
|
||||
gnc_localtime_r (&secs, &(box->date));
|
||||
gnc_date_cell_print_date (cell, buff);
|
||||
|
||||
gnc_basic_cell_set_value_internal (&cell->cell, buff);
|
||||
@@ -369,7 +369,7 @@ gnc_date_cell_set_value (DateCell *cell, int day, int mon, int year)
|
||||
dada.tm_year = year - 1900;
|
||||
|
||||
gnc_tm_set_day_start(&dada);
|
||||
mktime (&dada);
|
||||
gnc_mktime (&dada);
|
||||
|
||||
box->date.tm_mday = dada.tm_mday;
|
||||
box->date.tm_mon = dada.tm_mon;
|
||||
@@ -388,14 +388,12 @@ gnc_date_cell_set_value (DateCell *cell, int day, int mon, int year)
|
||||
}
|
||||
|
||||
void
|
||||
gnc_date_cell_set_value_secs (DateCell *cell, time_t secs)
|
||||
gnc_date_cell_set_value_secs (DateCell *cell, time64 secs)
|
||||
{
|
||||
PopBox *box = cell->cell.gui_private;
|
||||
char buff[DATE_BUF];
|
||||
struct tm * stm;
|
||||
|
||||
stm = localtime (&secs);
|
||||
box->date = *stm;
|
||||
gnc_localtime_r (&secs, &(box->date));
|
||||
|
||||
qof_print_date_dmy_buff (buff, MAX_DATE_LENGTH,
|
||||
box->date.tm_mday,
|
||||
@@ -699,7 +697,7 @@ gnc_date_cell_get_date (DateCell *cell, Timespec *ts)
|
||||
|
||||
gnc_parse_date (&(box->date), cell->cell.value);
|
||||
|
||||
ts->tv_sec = mktime (&box->date);
|
||||
ts->tv_sec = gnc_mktime (&box->date);
|
||||
ts->tv_nsec = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user