goffice r2130 - in trunk: . goffice/utils



Author: mortenw
Date: Wed Jun 25 19:48:18 2008
New Revision: 2130
URL: http://svn.gnome.org/viewvc/goffice?rev=2130&view=rev

Log:
2008-06-25  Morten Welinder  <terra gnome org>

	* goffice/utils/datetime.c (datetime_serial_to_timet): Check for
	valid date.



Modified:
   trunk/ChangeLog
   trunk/goffice/utils/datetime.c

Modified: trunk/goffice/utils/datetime.c
==============================================================================
--- trunk/goffice/utils/datetime.c	(original)
+++ trunk/goffice/utils/datetime.c	Wed Jun 25 19:48:18 2008
@@ -134,12 +134,14 @@
 datetime_serial_to_timet (int serial, GODateConventions const *conv)
 {
 	GDate gd;
-	struct tm tm;
 
 	datetime_serial_to_g (&gd, serial, conv);
-	g_date_to_struct_tm (&gd, &tm);
-
-	return mktime (&tm);
+	if (g_date_valid (&gd)) {
+		struct tm tm;
+		g_date_to_struct_tm (&gd, &tm);
+		return mktime (&tm);
+	} else
+		return -1;
 }
 
 /* ------------------------------------------------------------------------- */



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