gnumeric r16613 - in branches/gnumeric-1-8: . src



Author: mortenw
Date: Wed May 28 00:31:18 2008
New Revision: 16613
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16613&view=rev

Log:
2008-05-27  Morten Welinder  <terra gnome org>

	* src/stf-export.c (try_auto_date): Don't generate an invalid time
	format.  Fixes #534514.



Modified:
   branches/gnumeric-1-8/ChangeLog
   branches/gnumeric-1-8/NEWS
   branches/gnumeric-1-8/src/stf-export.c

Modified: branches/gnumeric-1-8/NEWS
==============================================================================
--- branches/gnumeric-1-8/NEWS	(original)
+++ branches/gnumeric-1-8/NEWS	Wed May 28 00:31:18 2008
@@ -1,5 +1,8 @@
 Gnumeric 1.8.4
 
+Morten:
+	* Fix text export problem for times with fractional seconds.  [#534514]
+
 --------------------------------------------------------------------------
 Gnumeric 1.8.3
 

Modified: branches/gnumeric-1-8/src/stf-export.c
==============================================================================
--- branches/gnumeric-1-8/src/stf-export.c	(original)
+++ branches/gnumeric-1-8/src/stf-export.c	Wed May 28 00:31:18 2008
@@ -159,6 +159,8 @@
 	v = value_get_as_float (value);
 	if (v >= 2958466)
 		return NULL;  /* Year 10000 or beyond.  */
+
+#warning "We need to deal with this when fixing #509720"
 	if (v < 0)
 		return NULL;
 	vr = gnm_fake_round (v);
@@ -166,7 +168,7 @@
 
 	needs_date = is_date || v >= 1;
 	needs_time = is_time || gnm_abs (v - vr) > 1e-9;
-	needs_frac_sec = needs_time && gnm_abs (vs - gnm_fake_trunc (vs)) > 1e-6;
+	needs_frac_sec = needs_time && gnm_abs (vs - gnm_fake_trunc (vs)) >= 0.5e-3;
 
 	xlfmt = g_string_new (NULL);
 	if (needs_date) g_string_append (xlfmt, "yyyy/mm/dd");
@@ -175,7 +177,7 @@
 			g_string_append_c (xlfmt, ' ');
 		g_string_append (xlfmt, "hh:mm:ss");
 		if (needs_frac_sec)
-			g_string_append (xlfmt, ".000000");
+			g_string_append (xlfmt, ".000");
 	}
 	actual = go_format_new_from_XL (xlfmt->str);
 	g_string_free (xlfmt, TRUE);



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