r22617 - gnucash/trunk/src/libqof/qof - Convert all time_t to time64: libqof
John Ralls
jralls at code.gnucash.org
Sat Dec 1 17:44:13 EST 2012
Author: jralls
Date: 2012-12-01 17:44:13 -0500 (Sat, 01 Dec 2012)
New Revision: 22617
Trac: http://svn.gnucash.org/trac/changeset/22617
Modified:
gnucash/trunk/src/libqof/qof/gnc-date.c
gnucash/trunk/src/libqof/qof/gnc-date.h
gnucash/trunk/src/libqof/qof/guid.c
gnucash/trunk/src/libqof/qof/kvp-util-p.h
gnucash/trunk/src/libqof/qof/kvp-util.c
gnucash/trunk/src/libqof/qof/qofbook.c
gnucash/trunk/src/libqof/qof/qofbook.h
gnucash/trunk/src/libqof/qof/qoflog.c
gnucash/trunk/src/libqof/qof/test/test-gnc-date.c
gnucash/trunk/src/libqof/qof/test/test-qofbook.c
Log:
Convert all time_t to time64: libqof
Modified: gnucash/trunk/src/libqof/qof/gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/gnc-date.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -1568,7 +1568,7 @@
void
-timespecFromTime_t( Timespec *ts, time64 t )
+timespecFromTime64 ( Timespec *ts, time64 t )
{
ts->tv_sec = t;
ts->tv_nsec = 0;
@@ -1584,7 +1584,7 @@
}
time64
-timespecToTime_t (Timespec ts)
+timespecToTime64 (Timespec ts)
{
return ts.tv_sec;
}
@@ -1646,7 +1646,7 @@
}
time64
-gnc_timet_get_day_start (time64 time_val)
+gnc_time64_get_day_start (time64 time_val)
{
struct tm tm;
time64 new_time;
@@ -1657,7 +1657,7 @@
}
time64
-gnc_timet_get_day_end (time64 time_val)
+gnc_time64_get_day_end (time64 time_val)
{
struct tm tm;
time64 new_time;
@@ -1683,7 +1683,7 @@
}
time64
-gnc_timet_get_today_start (void)
+gnc_time64_get_today_start (void)
{
struct tm tm;
@@ -1692,7 +1692,7 @@
}
time64
-gnc_timet_get_today_end (void)
+gnc_time64_get_today_end (void)
{
struct tm tm;
Modified: gnucash/trunk/src/libqof/qof/gnc-date.h
===================================================================
--- gnucash/trunk/src/libqof/qof/gnc-date.h 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/gnc-date.h 2012-12-01 22:44:13 UTC (rev 22617)
@@ -323,10 +323,10 @@
Timespec timespec_now (void);
/** Turns a time64 into a Timespec */
-void timespecFromTime_t( Timespec *ts, time64 t );
+void timespecFromTime64 (Timespec *ts, time64 t );
/** Turns a Timespec into a time64 */
-time64 timespecToTime_t (Timespec ts);
+time64 timespecToTime64 (Timespec ts);
/** Returns a newly allocated date of the current clock time, taken from
* time(2). The caller must g_date_free() the object afterwards. */
@@ -612,13 +612,13 @@
tm->tm_isdst = -1;
}
-/** The gnc_timet_get_day_start() routine will take the given time in
+/** The gnc_time64_get_day_start() routine will take the given time in
* seconds and adjust it to the last second of that day. */
-time64 gnc_timet_get_day_start(time64 time_val);
+time64 gnc_time64_get_day_start(time64 time_val);
-/** The gnc_timet_get_day_end() routine will take the given time in
+/** The gnc_time64_get_day_end() routine will take the given time in
* seconds and adjust it to the last second of that day. */
-time64 gnc_timet_get_day_end(time64 time_val);
+time64 gnc_time64_get_day_end(time64 time_val);
/** Get the numerical last date of the month. (28, 29, 30, 31) */
int gnc_date_get_last_mday (int month, int year);
@@ -637,13 +637,13 @@
* tm and fills it in with the last second of the today. */
void gnc_tm_get_today_end(struct tm *tm);
-/** The gnc_timet_get_today_start() routine returns a time64 value
+/** The gnc_time64_get_today_start() routine returns a time64 value
* corresponding to the first second of today. */
-time64 gnc_timet_get_today_start(void);
+time64 gnc_time64_get_today_start(void);
-/** The gnc_timet_get_today_end() routine returns a time64 value
+/** The gnc_time64_get_today_end() routine returns a time64 value
* corresponding to the last second of today. */
-time64 gnc_timet_get_today_end(void);
+time64 gnc_time64_get_today_end(void);
/** \brief Make a timestamp in YYYYMMDDHHMMSS format.
* @return A pointer to the generated string.
Modified: gnucash/trunk/src/libqof/qof/guid.c
===================================================================
--- gnucash/trunk/src/libqof/qof/guid.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/guid.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -315,7 +315,7 @@
init_from_time(void)
{
size_t total;
- time_t t_time;
+ time64 time;
#ifdef HAVE_SYS_TIMES_H
clock_t clocks;
struct tms tms_buf;
@@ -325,9 +325,9 @@
total = 0;
- t_time = time(NULL);
- md5_process_bytes(&t_time, sizeof(t_time), &guid_context);
- total += sizeof(t_time);
+ time = gnc_time (NULL);
+ md5_process_bytes(&time, sizeof(time), &guid_context);
+ total += sizeof(time);
#ifdef HAVE_SYS_TIMES_H
clocks = times(&tms_buf);
@@ -492,7 +492,7 @@
{
int n, i;
- srand((unsigned int) time(NULL));
+ srand((unsigned int) gnc_time (NULL));
for (i = 0; i < 32; i++)
{
Modified: gnucash/trunk/src/libqof/qof/kvp-util-p.h
===================================================================
--- gnucash/trunk/src/libqof/qof/kvp-util-p.h 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/kvp-util-p.h 2012-12-01 22:44:13 UTC (rev 22617)
@@ -68,7 +68,7 @@
* NULL if an error occured.
*/
-KvpFrame * gnc_kvp_bag_add (KvpFrame *kvp_root, const char *path, time_t secs,
+KvpFrame * gnc_kvp_bag_add (KvpFrame *kvp_root, const char *path, time64 secs,
const char *first_name, ...);
Modified: gnucash/trunk/src/libqof/qof/kvp-util.c
===================================================================
--- gnucash/trunk/src/libqof/qof/kvp-util.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/kvp-util.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -34,7 +34,7 @@
static KvpFrame *
gnc_kvp_array_va (KvpFrame *kvp_root, const char * path,
- time_t secs, const char * first_name, va_list ap)
+ time64 secs, const char * first_name, va_list ap)
{
KvpFrame *cwd;
Timespec ts;
@@ -72,7 +72,7 @@
KvpFrame *
gnc_kvp_bag_add (KvpFrame *pwd, const char * path,
- time_t secs, const char *first_name, ...)
+ time64 secs, const char *first_name, ...)
{
KvpFrame *cwd;
va_list ap;
Modified: gnucash/trunk/src/libqof/qof/qofbook.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofbook.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/qofbook.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -184,13 +184,13 @@
{
/* Set the session dirty upfront, because the callback will check. */
book->session_dirty = TRUE;
- book->dirty_time = time(NULL);
+ book->dirty_time = gnc_time (NULL);
if (book->dirty_cb)
book->dirty_cb(book, TRUE, book->dirty_data);
}
}
-time_t
+time64
qof_book_get_session_dirty_time (const QofBook *book)
{
return book->dirty_time;
Modified: gnucash/trunk/src/libqof/qof/qofbook.h
===================================================================
--- gnucash/trunk/src/libqof/qof/qofbook.h 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/qofbook.h 2012-12-01 22:44:13 UTC (rev 22617)
@@ -81,7 +81,7 @@
/* The time when the book was first dirtied. This is a secondary
* indicator. It should only be used when session_saved is FALSE. */
- time_t dirty_time;
+ time64 dirty_time;
/* This callback function is called any time the book dirty flag
* changes state. Both clean->dirty and dirty->clean transitions
@@ -296,7 +296,7 @@
void qof_book_mark_session_dirty(QofBook *book);
/** Retrieve the earliest modification time on the book. */
-time_t qof_book_get_session_dirty_time(const QofBook *book);
+time64 qof_book_get_session_dirty_time(const QofBook *book);
/** Set the function to call when a book transitions from clean to
* dirty, or vice versa.
Modified: gnucash/trunk/src/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qoflog.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/qoflog.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -103,7 +103,7 @@
{
char timestamp_buf[10];
- time_t now;
+ time64 now;
struct tm now_tm;
const char *format_24hour =
#ifdef G_OS_WIN32
@@ -113,8 +113,8 @@
#endif
;
gchar *level_str = qof_log_level_to_string(log_level);
- now = time(NULL);
- localtime_r(&now, &now_tm);
+ now = gnc_time (NULL);
+ gnc_localtime_r (&now, &now_tm);
qof_strftime(timestamp_buf, 9, format_24hour, &now_tm);
fprintf(fout, "* %s %*s <%s> %*s%s%s",
Modified: gnucash/trunk/src/libqof/qof/test/test-gnc-date.c
===================================================================
--- gnucash/trunk/src/libqof/qof/test/test-gnc-date.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/test/test-gnc-date.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -42,7 +42,7 @@
{
GDateTime *(*new_local)(gint, gint, gint, gint, gint, gdouble);
GDateTime *(*adjust_for_dst)(GDateTime *, GTimeZone *);
- GDateTime *(*new_from_unix_local)(gint64);
+ GDateTime *(*new_from_unix_local)(time64);
GDateTime *(*new_from_timeval_local)(GTimeVal *);
GDateTime *(*new_now_local)(void);
GDateTime *(*to_local)(GDateTime *);
@@ -57,7 +57,7 @@
static void
test_gnc_localtime (void)
{
- gint64 secs[5] = {-43238956734LL, -1123692LL, 432761LL,
+ time64 secs[5] = {-43238956734LL, -1123692LL, 432761LL,
723349832LL, 887326459367LL};
guint ind;
gchar *msg = "gnc_localtime_r: assertion `gdt != NULL' failed";
@@ -103,7 +103,7 @@
static void
test_gnc_gmtime (void)
{
- gint64 secs[6] = {-43238956734LL, -1123692LL, 432761LL,
+ time64 secs[6] = {-43238956734LL, -1123692LL, 432761LL,
723349832LL, 887326459367LL, 1175964426LL};
struct tm answers[6] = {
#ifdef HAVE_STRUCT_TM_GMTOFF
@@ -162,7 +162,7 @@
test_gnc_mktime (void)
{
struct {
- gint64 secs;
+ time64 secs;
gint wday;
gint yday;
} ans[5] = {
@@ -192,14 +192,14 @@
for (ind = 0; ind < G_N_ELEMENTS (time); ind++)
{
- gint64 secs = gnc_mktime (&time[ind]);
+ time64 secs = gnc_mktime (&time[ind]);
GDateTime *gdt = gncdt.new_local (time[ind].tm_year + 1900,
time[ind].tm_mon + 1,
time[ind].tm_mday,
time[ind].tm_hour,
time[ind].tm_min,
(gdouble)time[ind].tm_sec);
- gint64 offset = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
+ time64 offset = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
g_assert_cmpint (secs, ==, ans[ind].secs - offset);
g_assert_cmpint (time[ind].tm_wday, ==, ans[ind].wday);
g_assert_cmpint (time[ind].tm_yday, ==, ans[ind].yday);
@@ -223,7 +223,7 @@
test_gnc_mktime_normalization (void)
{
struct answer {
- gint64 secs;
+ time64 secs;
gint wday;
gint yday;
} ans = { 723349832LL, 4, 338 };
@@ -251,14 +251,14 @@
guint ind;
for (ind = 0; ind < G_N_ELEMENTS (time); ind++)
{
- gint64 secs = gnc_mktime (&time[ind]);
+ time64 secs = gnc_mktime (&time[ind]);
GDateTime *gdt = gncdt.new_local (time[ind].tm_year + 1900,
time[ind].tm_mon + 1,
time[ind].tm_mday,
time[ind].tm_hour,
time[ind].tm_min,
(gdouble)time[ind].tm_sec);
- gint64 offset = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
+ time64 offset = g_date_time_get_utc_offset (gdt) / G_TIME_SPAN_SECOND;
g_assert_cmpfloat (time[ind].tm_sec, ==, normal_time.tm_sec);
g_assert_cmpint (time[ind].tm_min, ==, normal_time.tm_min);
g_assert_cmpint (time[ind].tm_hour, ==, normal_time.tm_hour);
@@ -282,7 +282,7 @@
static void
test_gnc_ctime (void)
{
- gint64 secs[5] = {-43238956734LL, -1123692LL, 432761LL,
+ time64 secs[5] = {-43238956734LL, -1123692LL, 432761LL,
723349832LL, 1175964426LL};
guint ind;
for (ind = 0; ind < G_N_ELEMENTS (secs); ind++)
@@ -299,7 +299,7 @@
static void
test_gnc_time (void)
{
- gint64 secs1, secs2;
+ time64 secs1, secs2;
GDateTime *gdt;
secs1 = gnc_time (NULL);
secs1 = gnc_time (&secs2);
@@ -480,11 +480,11 @@
{
const int sec_per_day = 24 * 3600;
const int sec_per_mo = 30 * sec_per_day;
- const gint64 sec_per_yr = 365 * sec_per_day;
+ const time64 sec_per_yr = 365 * sec_per_day;
const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
- const gint64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
- const gint64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
- const gint64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
+ const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+ const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+ const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
Timespec ta = { secs1, nsec1 };
Timespec tb = { secs2, nsec2 };
Timespec tc = { secs1, nsec1 };
@@ -508,11 +508,11 @@
{
const int sec_per_day = 24 * 3600;
const int sec_per_mo = 30 * sec_per_day;
- const gint64 sec_per_yr = 365 * sec_per_day;
+ const time64 sec_per_yr = 365 * sec_per_day;
const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
- const gint64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
- const gint64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
- const gint64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
+ const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+ const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+ const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
Timespec ta = { secs1, nsec1 };
Timespec tb = { secs2, nsec2 };
Timespec tc = { secs1, nsec1 };
@@ -542,11 +542,11 @@
{
const gint sec_per_day = 24 * 3600;
const gint sec_per_mo = 30 * sec_per_day;
- const gint64 sec_per_yr = 365 * sec_per_day;
- const gint64 nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
- const gint64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
- const gint64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
- const gint64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
+ const time64 sec_per_yr = 365 * sec_per_day;
+ const time64 nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
+ const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+ const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+ const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day;
Timespec ta = { secs1, nsec1 };
Timespec tb = { secs2, nsec2 };
Timespec td = { secs3, nsec1 };
@@ -556,6 +556,7 @@
Timespec th = { secs1, -nsec3 };
Timespec tt = timespec_diff (&ta, &ta);
+
g_assert_cmpint (tt.tv_sec, ==, 0);
g_assert_cmpint (tt.tv_nsec, ==, 0);
@@ -572,7 +573,7 @@
g_assert_cmpint (tt.tv_nsec, ==, 0);
tt = timespec_diff (&tf, &th);
- if (sizeof (time_t) > 4)
+ if (sizeof (glong) > 4)
{
glong nsec_diff_norm = 2 * nsec3 - 2 * NANOS_PER_SECOND - NANOS_PER_SECOND;
g_assert_cmpint (tt.tv_sec, ==, secs2 - secs1 + 2);
@@ -599,8 +600,8 @@
const int sec_per_mo = 30 * sec_per_day;
const int sec_per_yr = 365 * sec_per_day;
const int nsec1 = 439652, nsec2 = 132794892, nsec3 = 1132794892;
- const gint64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
- const gint64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
+ const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day;
+ const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day;
Timespec ta = { secs1, nsec1 };
Timespec tf = { secs2 - 1, nsec3 }; /* When normalized, equal to tb */
Timespec tg = { -secs2, nsec2 };
@@ -648,11 +649,11 @@
{
const int sec_per_day = 24 * 3600;
const int sec_per_mo = 30 * sec_per_day;
- const gint64 sec_per_yr = 365 * sec_per_day;
- const gint64 secs = 8 * 3600 + 43 * 60 + 11;
- const gint64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day + 8 * 3600 + 43 * 60 + 11;
- const gint64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day + 21 * 3600 + 9 * 60 + 48;
- const gint64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day + 12 * 60;
+ const time64 sec_per_yr = 365 * sec_per_day;
+ const time64 secs = 8 * 3600 + 43 * 60 + 11;
+ const time64 secs1 = 23 * sec_per_yr + 5 * sec_per_mo + 11 * sec_per_day + 8 * 3600 + 43 * 60 + 11;
+ const time64 secs2 = 21 * sec_per_yr + 11 * sec_per_mo + 19 * sec_per_day + 21 * 3600 + 9 * 60 + 48;
+ const time64 secs3 = 72 * sec_per_yr + 2 * sec_per_mo + 26 * sec_per_day + 12 * 60;
Timespec t0 = { secs, 0 };
Timespec ta = { secs1, 0 };
Timespec tb = { secs2, 0 };
@@ -928,7 +929,7 @@
#define test_assert_localized_timestring(time, datestr) \
{ \
gchar t_buff[MAX_DATE_LENGTH]; \
- struct tm *ltime = gnc_localtime ((gint64 *)(&time)); \
+ struct tm *ltime = gnc_localtime ((time64 *)(&time)); \
strftime (t_buff, sizeof (t_buff), GNC_D_FMT, ltime); \
gnc_tm_free (ltime); \
g_assert_cmpstr (datestr, ==, t_buff); \
@@ -937,7 +938,7 @@
/* qof_print_date_buff
size_t
-qof_print_date_buff (char * buff, size_t len, time_t t)// C: 3 in 1 Local: 2:0:0
+qof_print_date_buff (char * buff, size_t len, time64 t)// C: 3 in 1 Local: 2:0:0
*/
static void
test_qof_print_date_buff (void)
@@ -948,9 +949,9 @@
GDateTime *gd2 = gncdt.new_local (1961, 2, 2, 12, 0, 0.0);
GDateTime *gd3 = gncdt.new_local (2045, 6, 16, 12, 0, 0.0);
- gint64 tm1 = g_date_time_to_unix (gd1);
- gint64 tm2 = g_date_time_to_unix (gd2);
- gint64 tm3 = g_date_time_to_unix (gd3);
+ time64 tm1 = g_date_time_to_unix (gd1);
+ time64 tm2 = g_date_time_to_unix (gd2);
+ time64 tm3 = g_date_time_to_unix (gd3);
qof_date_format_set (QOF_DATE_FORMAT_UK);
memset ((gpointer)buff, 0, sizeof (buff));
@@ -1217,7 +1218,7 @@
/* qof_print_date
char *
-qof_print_date (time_t t)// C: 29 in 13 Local: 0:0:0
+qof_print_date (time64 t)// C: 29 in 13 Local: 0:0:0
*/
static void
test_qof_print_date (void)
@@ -1228,9 +1229,9 @@
GDateTime *gd2 = gncdt.new_local (1961, 2, 2, 12, 0, 0.0);
GDateTime *gd3 = gncdt.new_local (2045, 6, 16, 12, 0, 0.0);
- gint64 tm1 = g_date_time_to_unix (gd1);
- gint64 tm2 = g_date_time_to_unix (gd2);
- gint64 tm3 = g_date_time_to_unix (gd3);
+ time64 tm1 = g_date_time_to_unix (gd1);
+ time64 tm2 = g_date_time_to_unix (gd2);
+ time64 tm3 = g_date_time_to_unix (gd3);
qof_date_format_set (QOF_DATE_FORMAT_UK);
test_assert_qof_print_date (tm1, "23/11/1974");
@@ -1936,12 +1937,12 @@
test_gnc_timezone (void)
{
}*/
-/* timespecFromTime_t
+/* timespecFromtime64
void
-timespecFromTime_t( Timespec *ts, time_t t )// C: 22 in 11 Local: 0:0:0
+timespecFromtime64( Timespec *ts, time64 t )// C: 22 in 11 Local: 0:0:0
*/
/* static void
-test_timespecFromTime_t (void)
+test_timespecFromtime64 (void)
{
}*/
/* timespec_now
@@ -1952,12 +1953,12 @@
test_timespec_now (void)
{
}*/
-/* timespecToTime_t
-time_t
-timespecToTime_t (Timespec ts)// C: 10 in 6 Local: 1:0:0
+/* timespecTotime64
+time64
+timespecTotime64 (Timespec ts)// C: 10 in 6 Local: 1:0:0
*/
/* static void
-test_timespecToTime_t (void)
+test_timespecTotime64 (void)
{
}*/
/* timespec_to_gdate
@@ -2093,7 +2094,7 @@
}
/* gnc_tm_get_day_start
static void
-gnc_tm_get_day_start (struct tm *tm, time_t time_val)// Local: 3:0:0
+gnc_tm_get_day_start (struct tm *tm, time64 time_val)// Local: 3:0:0
*/
/* static void
test_gnc_tm_get_day_start (void)
@@ -2101,18 +2102,18 @@
}*/
/* gnc_tm_get_day_end
static void
-gnc_tm_get_day_end (struct tm *tm, time_t time_val)// Local: 3:0:0
+gnc_tm_get_day_end (struct tm *tm, time64 time_val)// Local: 3:0:0
*/
/* static void
test_gnc_tm_get_day_end (void)
{
}*/
-/* gnc_timet_get_day_start
-time_t
-gnc_timet_get_day_start (time_t time_val)// C: 8 in 7 Local: 0:0:0
+/* gnc_time64_get_day_start
+time64
+gnc_time64_get_day_start (time64 time_val)// C: 8 in 7 Local: 0:0:0
*/
static void
-test_gnc_timet_get_day_start (void)
+test_gnc_time64_get_day_start (void)
{
GTimeZone *zulu = g_time_zone_new ("Z");
GTimeZone *tz05 = g_time_zone_new ("-05");
@@ -2126,14 +2127,14 @@
GDateTime *gdt_local, *gdt_day_begin;
gint day, mon, yr;
- gint64 time, t_time, r_time;
+ time64 time, t_time, r_time;
gdt_local = gncdt.to_local (gdt0);
time = g_date_time_to_unix (gdt0);
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_begin = gncdt.new_local (yr, mon, day, 0, 0, 0);
t_time = g_date_time_to_unix (gdt_day_begin);
- r_time = gnc_timet_get_day_start (time);
+ r_time = gnc_time64_get_day_start (time);
/* This will work in the half of the world where localtime is later than UTC */
g_assert_cmpint (t_time, ==, r_time);
@@ -2142,7 +2143,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_begin = gncdt.new_local (yr, mon, day, 0, 0, 0);
t_time = g_date_time_to_unix (gdt_day_begin);
- r_time = gnc_timet_get_day_start (time);
+ r_time = gnc_time64_get_day_start (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt2);
@@ -2150,7 +2151,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_begin = gncdt.new_local (yr, mon, day, 0, 0, 0);
t_time = g_date_time_to_unix (gdt_day_begin);
- r_time = gnc_timet_get_day_start (time);
+ r_time = gnc_time64_get_day_start (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt3);
@@ -2158,7 +2159,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_begin = gncdt.new_local (yr, mon, day, 0, 0, 0);
t_time = g_date_time_to_unix (gdt_day_begin);
- r_time = gnc_timet_get_day_start (time);
+ r_time = gnc_time64_get_day_start (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt4);
@@ -2166,7 +2167,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_begin = gncdt.new_local (yr, mon, day, 0, 0, 0);
t_time = g_date_time_to_unix (gdt_day_begin);
- r_time = gnc_timet_get_day_start (time);
+ r_time = gnc_time64_get_day_start (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt5);
@@ -2174,7 +2175,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_begin = gncdt.new_local (yr, mon, day, 0, 0, 0);
t_time = g_date_time_to_unix (gdt_day_begin);
- r_time = gnc_timet_get_day_start (time);
+ r_time = gnc_time64_get_day_start (time);
g_assert_cmpint (t_time, ==, r_time);
g_date_time_unref (gdt0);
@@ -2187,12 +2188,12 @@
g_time_zone_unref (tz05);
g_time_zone_unref (tz0840);
}
-/* gnc_timet_get_day_end
-time_t
-gnc_timet_get_day_end (time_t time_val)// C: 12 in 8 Local: 0:0:0
+/* gnc_time64_get_day_end
+time64
+gnc_time64_get_day_end (time64 time_val)// C: 12 in 8 Local: 0:0:0
*/
static void
-test_gnc_timet_get_day_end (void)
+test_gnc_time64_get_day_end (void)
{
GTimeZone *zulu = g_time_zone_new ("Z");
GTimeZone *tz05 = g_time_zone_new ("-05");
@@ -2206,14 +2207,14 @@
GDateTime *gdt_local, *gdt_day_end;
gint day, mon, yr;
- gint64 time, t_time, r_time;
+ time64 time, t_time, r_time;
gdt_local = gncdt.to_local (gdt0);
time = g_date_time_to_unix (gdt0);
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_end = gncdt.new_local (yr, mon, day, 23, 59, 59);
t_time = g_date_time_to_unix (gdt_day_end);
- r_time = gnc_timet_get_day_end (time);
+ r_time = gnc_time64_get_day_end (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt1);
@@ -2221,7 +2222,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_end = gncdt.new_local (yr, mon, day, 23, 59, 59);
t_time = g_date_time_to_unix (gdt_day_end);
- r_time = gnc_timet_get_day_end (time);
+ r_time = gnc_time64_get_day_end (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt2);
@@ -2229,7 +2230,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_end = gncdt.new_local (yr, mon, day, 23, 59, 59);
t_time = g_date_time_to_unix (gdt_day_end);
- r_time = gnc_timet_get_day_end (time);
+ r_time = gnc_time64_get_day_end (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt3);
@@ -2237,7 +2238,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_end = gncdt.new_local (yr, mon, day, 23, 59, 59);
t_time = g_date_time_to_unix (gdt_day_end);
- r_time = gnc_timet_get_day_end (time);
+ r_time = gnc_time64_get_day_end (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt4);
@@ -2245,7 +2246,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_end = gncdt.new_local (yr, mon, day, 23, 59, 59);
t_time = g_date_time_to_unix (gdt_day_end);
- r_time = gnc_timet_get_day_end (time);
+ r_time = gnc_time64_get_day_end (time);
g_assert_cmpint (t_time, ==, r_time);
gdt_local = gncdt.to_local (gdt5);
@@ -2253,7 +2254,7 @@
g_date_time_get_ymd (gdt_local, &yr, &mon, &day);
gdt_day_end = gncdt.new_local (yr, mon, day, 23, 59, 59);
t_time = g_date_time_to_unix (gdt_day_end);
- r_time = gnc_timet_get_day_end (time);
+ r_time = gnc_time64_get_day_end (time);
g_assert_cmpint (t_time, ==, r_time);
g_date_time_unref (gdt0);
@@ -2279,20 +2280,20 @@
void
gnc_tm_get_today_end (struct tm *tm)// Local: 0:0:0
*/
-/* gnc_timet_get_today_start
-time_t
-gnc_timet_get_today_start (void)// C: 7 in 4 Local: 0:0:0
+/* gnc_time64_get_today_start
+time64
+gnc_time64_get_today_start (void)// C: 7 in 4 Local: 0:0:0
*/
/* static void
-test_gnc_timet_get_today_start (void)
+test_gnc_time64_get_today_start (void)
{
}*/
-/* gnc_timet_get_today_end
-time_t
-gnc_timet_get_today_end (void)// C: 8 in 5 Local: 0:0:0
+/* gnc_time64_get_today_end
+time64
+gnc_time64_get_today_end (void)// C: 8 in 5 Local: 0:0:0
*/
/* static void
-test_gnc_timet_get_today_end (void)
+test_gnc_time64_get_today_end (void)
{
}*/
/* gnc_dow_abbrev
@@ -2373,18 +2374,18 @@
GNC_TEST_ADD_FUNC (suitename, "gnc dmy2timespec", test_gnc_dmy2timespec);
GNC_TEST_ADD_FUNC (suitename, "gnc dmy2timespec end", test_gnc_dmy2timespec_end);
// GNC_TEST_ADD_FUNC (suitename, "gnc timezone", test_gnc_timezone);
-// GNC_TEST_ADD_FUNC (suitename, "timespecFromTime t", test_timespecFromTime_t);
+// GNC_TEST_ADD_FUNC (suitename, "timespecFromTime t", test_timespecFromtime64);
// GNC_TEST_ADD_FUNC (suitename, "timespec now", test_timespec_now);
-// GNC_TEST_ADD_FUNC (suitename, "timespecToTime t", test_timespecToTime_t);
+// GNC_TEST_ADD_FUNC (suitename, "timespecToTime t", test_timespecTotime64);
GNC_TEST_ADD_FUNC (suitename, "timespec to gdate", test_timespec_to_gdate);
GNC_TEST_ADD_FUNC (suitename, "gdate to timespec", test_gdate_to_timespec);
// GNC_TEST_ADD_FUNC (suitename, "gnc tm get day start", test_gnc_tm_get_day_start);
// GNC_TEST_ADD_FUNC (suitename, "gnc tm get day end", test_gnc_tm_get_day_end);
- GNC_TEST_ADD_FUNC (suitename, "gnc timet get day start", test_gnc_timet_get_day_start);
- GNC_TEST_ADD_FUNC (suitename, "gnc timet get day end", test_gnc_timet_get_day_end);
+ GNC_TEST_ADD_FUNC (suitename, "gnc time64 get day start", test_gnc_time64_get_day_start);
+ GNC_TEST_ADD_FUNC (suitename, "gnc time64 get day end", test_gnc_time64_get_day_end);
// GNC_TEST_ADD_FUNC (suitename, "gnc tm get today start", test_gnc_tm_get_today_start);
-// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today start", test_gnc_timet_get_today_start);
-// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today end", test_gnc_timet_get_today_end);
+// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today start", test_gnc_time64_get_today_start);
+// GNC_TEST_ADD_FUNC (suitename, "gnc timet get today end", test_gnc_time64_get_today_end);
// GNC_TEST_ADD_FUNC (suitename, "gnc dow abbrev", test_gnc_dow_abbrev);
// GNC_TEST_ADD_FUNC (suitename, "timespec boxed copy func", test_timespec_boxed_copy_func);
// GNC_TEST_ADD_FUNC (suitename, "timespec boxed free func", test_timespec_boxed_free_func);
Modified: gnucash/trunk/src/libqof/qof/test/test-qofbook.c
===================================================================
--- gnucash/trunk/src/libqof/qof/test/test-qofbook.c 2012-12-01 22:44:03 UTC (rev 22616)
+++ gnucash/trunk/src/libqof/qof/test/test-qofbook.c 2012-12-01 22:44:13 UTC (rev 22617)
@@ -213,7 +213,7 @@
static void
test_book_mark_session_saved( Fixture *fixture, gconstpointer pData )
{
- time_t dirty_time, clean_time;
+ time64 dirty_time, clean_time;
qof_book_mark_session_dirty( fixture-> book );
g_assert( qof_book_session_not_saved( fixture->book ) );
@@ -423,7 +423,7 @@
test_book_mark_session_dirty( Fixture *fixture, gconstpointer pData )
{
QofBook *_empty = NULL;
- time_t before, after;
+ time64 before, after;
guint param = (guint) g_test_rand_int();
g_test_message( "Testing when book is NULL" );
@@ -434,9 +434,9 @@
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), == , 0);
g_assert( fixture->book->dirty_cb == NULL );
g_assert( qof_book_session_not_saved( fixture->book ) == FALSE );
- before = time( NULL );
+ before = gnc_time (NULL);
qof_book_mark_session_dirty( fixture->book );
- after = time( NULL );
+ after = gnc_time (NULL);
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), >= , before);
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), <= , after);
g_assert( qof_book_session_not_saved( fixture->book ) == TRUE );
@@ -451,9 +451,9 @@
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), == , 0);
g_assert( qof_book_session_not_saved( fixture->book ) == FALSE );
/* run FUT */
- before = time( NULL );
+ before = gnc_time (NULL);
qof_book_mark_session_dirty( fixture->book );
- after = time( NULL );
+ after = gnc_time (NULL);
/* test output */
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), >= , before);
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), <= , after);
@@ -472,16 +472,16 @@
static void
test_book_get_session_dirty_time( Fixture *fixture, gconstpointer pData )
{
- time_t before, after;
+ time64 before, after;
g_test_message( "Testing time on saved book = 0" );
g_assert( qof_book_session_not_saved( fixture->book ) == FALSE );
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), == , 0);
g_test_message( "Testing time on dirty book is correct" );
- before = time( NULL );
+ before = gnc_time (NULL);
qof_book_mark_session_dirty( fixture->book );
- after = time( NULL );
+ after = gnc_time (NULL);
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), >= , before);
g_assert_cmpint( qof_book_get_session_dirty_time( fixture->book ), <= , after);
More information about the gnucash-changes
mailing list