update to GDateTime

This commit is contained in:
John Cupitt 2019-10-29 20:31:43 +00:00
parent 23663e8a88
commit 7321927361
1 changed files with 17 additions and 2 deletions

View File

@ -955,22 +955,37 @@ char *
vips__xml_properties( VipsImage *image )
{
VipsDbuf dbuf;
GTimeVal now;
char *date;
vips_dbuf_init( &dbuf );
#ifdef HAVE_DATE_TIME_FORMAT_ISO8601
{
GDateTime *now;
now = g_date_time_new_now_local();
date = g_date_time_format_iso8601( now );
g_date_time_unref( now );
}
#else /*!HAVE_DATE_TIME_FORMAT_ISO8601*/
{
GTimeVal now;
g_get_current_time( &now );
date = g_time_val_to_iso8601( &now );
}
#endif /*HAVE_DATE_TIME_FORMAT_ISO8601*/
vips_dbuf_writef( &dbuf, "<?xml version=\"1.0\"?>\n" );
vips_dbuf_writef( &dbuf, "<image xmlns=\"%s/dzsave\" "
"date=\"%s\" version=\"%d.%d.%d\">\n",
NAMESPACE_URI,
date,
VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION, VIPS_MICRO_VERSION );
g_free( date );
vips_dbuf_writef( &dbuf, " <properties>\n" );
g_free( date );
if( vips_image_map( image, vips__xml_properties_meta, &dbuf ) ) {
vips_dbuf_destroy( &dbuf );
return( NULL );