From 7321927361fe438530f2774d7a6cdfbba228711f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 29 Oct 2019 20:31:43 +0000 Subject: [PATCH] update to GDateTime --- libvips/iofuncs/vips.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libvips/iofuncs/vips.c b/libvips/iofuncs/vips.c index 6e9c0fcc..d3c2df30 100644 --- a/libvips/iofuncs/vips.c +++ b/libvips/iofuncs/vips.c @@ -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, "\n" ); vips_dbuf_writef( &dbuf, "\n", NAMESPACE_URI, date, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION, VIPS_MICRO_VERSION ); - g_free( date ); vips_dbuf_writef( &dbuf, " \n" ); + g_free( date ); + if( vips_image_map( image, vips__xml_properties_meta, &dbuf ) ) { vips_dbuf_destroy( &dbuf ); return( NULL );