changeset 16004:b4593c886933

fix our string-to-time function, and add a couple tests for it
author Nathan Walp <nwalp@pidgin.im>
date Sat, 07 Apr 2007 04:43:50 +0000
parents 7b8b16670140
children f4af78528aa2 c8a416fd8114
files libpurple/tests/test_util.c libpurple/util.c
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/tests/test_util.c	Fri Apr 06 23:09:25 2007 +0000
+++ b/libpurple/tests/test_util.c	Sat Apr 07 04:43:50 2007 +0000
@@ -74,6 +74,13 @@
 }
 END_TEST
 
+START_TEST(test_util_str_to_time)
+{
+	fail_unless(377185800 == purple_str_to_time("19811214T12:50:00", TRUE, NULL, NULL, NULL));
+	fail_unless(1175919261 == purple_str_to_time("20070407T04:14:21", TRUE, NULL, NULL, NULL));
+}
+END_TEST
+
 Suite *
 util_suite(void)
 {
@@ -102,5 +109,9 @@
 	tcase_add_test(tc, test_util_email_is_valid);
 	suite_add_tcase(s, tc);
 
+	tc = tcase_create("Time");
+	tcase_add_test(tc, test_util_str_to_time);
+	suite_add_tcase(s, tc);
+
 	return s;
 }
--- a/libpurple/util.c	Fri Apr 06 23:09:25 2007 +0000
+++ b/libpurple/util.c	Sat Apr 07 04:43:50 2007 +0000
@@ -794,7 +794,7 @@
 			}
 			else if (utc)
 			{
-				t->tm_isdst = 0;
+				t->tm_isdst = -1;
 			}
 
 			if (rest != NULL && *c != '\0')