[gnumeric] DocProps: use GsfTimestamp for timestamps, not strings.



commit 8d6dac99338fc71dc211ac4da9efc969e3b219a9
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 11 11:14:41 2011 -0500

    DocProps: use GsfTimestamp for timestamps, not strings.

 ChangeLog    |    4 ++++
 NEWS         |    1 +
 src/gutils.c |   17 +++++++++++------
 3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3b5eb55..e00d708 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-03-11  Morten Welinder  <terra gnome org>
+
+	* src/gutils.c (gnm_insert_meta_date): Use GsfTimestamp.
+
 2011-03-10  Morten Welinder  <terra gnome org>
 
 	* src/colrow.c (colrow_new, colrow_free): New functions.
diff --git a/NEWS b/NEWS
index 03d6b84..b68e384 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,7 @@ Morten:
 	* Import sheet visibility from xlsx.  [#643815]
 	* Import names from xlsx.  [#643874]
 	* Improve dbf codepage support.  [#644189]
+	* Improve date format consistency in document properies.  [#644217]
 
 Stanley Pinchak:
 	* Improve "dif" output.
diff --git a/src/gutils.c b/src/gutils.c
index 34014df..f6c868b 100644
--- a/src/gutils.c
+++ b/src/gutils.c
@@ -30,6 +30,7 @@
 #include <locale.h>
 #include <gsf/gsf-impl-utils.h>
 #include <gsf/gsf-doc-meta-data.h>
+#include <gsf/gsf-timestamp.h>
 
 static char *gnumeric_lib_dir;
 static char *gnumeric_data_dir;
@@ -449,13 +450,17 @@ void
 gnm_insert_meta_date (GODoc *doc, char const *name)
 {
 	GValue *value = g_new0 (GValue, 1);
-	GTimeVal time;
+	GTimeVal tm;
+	GsfTimestamp *ts = gsf_timestamp_new ();
+
+	g_get_current_time (&tm);
+	tm.tv_usec = 0L;
+
+	gsf_timestamp_set_time (ts, tm.tv_sec);
+	g_value_init (value, GSF_TIMESTAMP_TYPE);
+	gsf_value_set_timestamp (value, ts);
+	gsf_timestamp_free (ts);
 
-	g_get_current_time (&time);
-	time.tv_usec = 0L;
-	g_value_init (value, G_TYPE_STRING);
-	g_value_take_string (value,
-			     g_time_val_to_iso8601 (&time));
 	gsf_doc_meta_data_insert (go_doc_get_meta_data (doc),
 				  g_strdup (name),
 				  value);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]