Convenience GDate functions to set to today and an arbitrary time64.

To replace most uses of g_date_set_time_t().

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22616 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls
2012-12-01 22:44:03 +00:00
parent 17bdb2a679
commit 8fa49c4a21
+20 -1
View File
@@ -23,10 +23,29 @@
#include "config.h"
#include <glib.h>
#include <time.h>
#include <gnc-date.h>
#include "gnc-gdate-utils.h"
void
gnc_gdate_set_today (GDate* gd)
{
GDateTime *gdt = g_date_time_new_now_local ();
gint y, m, d;
g_date_time_get_ymd (gdt, &y, &m, &d);
g_date_set_dmy (gd, d, m, y);
g_date_time_unref (gdt);
}
void
gnc_gdate_set_time64 (GDate* gd, time64 time)
{
GDateTime *gdt = g_date_time_new_from_unix_local (time);
gint y, m, d;
g_date_time_get_ymd (gdt, &y, &m, &d);
g_date_set_dmy (gd, d, m, y);
g_date_time_unref (gdt);
}
gboolean
gnc_gdate_equal(gconstpointer gda, gconstpointer gdb)