mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add support for passing a Timespec as a boxed GValue
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18769 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1520,3 +1520,38 @@ gnc_dow_abbrev(gchar *buf, int buf_len, int dow)
|
||||
i = qof_strftime(buf, buf_len, "%a", &my_tm);
|
||||
buf[i] = 0;
|
||||
}
|
||||
|
||||
/* *******************************************************************
|
||||
* GValue handling
|
||||
********************************************************************/
|
||||
static gpointer
|
||||
timespec_boxed_copy_func( gpointer in_timespec )
|
||||
{
|
||||
Timespec* newvalue;
|
||||
|
||||
newvalue = g_malloc( sizeof( Timespec ) );
|
||||
memcpy( newvalue, in_timespec, sizeof( Timespec ) );
|
||||
|
||||
return newvalue;
|
||||
}
|
||||
|
||||
static void
|
||||
timespec_boxed_free_func( gpointer in_timespec )
|
||||
{
|
||||
g_free( in_timespec );
|
||||
}
|
||||
|
||||
GType
|
||||
timespec_get_type( void )
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if ( type == 0 )
|
||||
{
|
||||
type = g_boxed_type_register_static( "timespec",
|
||||
timespec_boxed_copy_func,
|
||||
timespec_boxed_free_func );
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -67,8 +67,16 @@
|
||||
#ifndef GNC_DATE_H
|
||||
#define GNC_DATE_H
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <time.h>
|
||||
|
||||
/** @name GValue
|
||||
@{
|
||||
*/
|
||||
GType timespec_get_type( void );
|
||||
#define GNC_TYPE_TIMESPEC (timespec_get_type ())
|
||||
|
||||
/** @} */
|
||||
/** The default date format for use with strftime. */
|
||||
extern const char *gnc_default_strftime_date_format;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user