mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
Fix the date validation check. (#503029)
2007-12-19 Emmanuele Bassi <ebassi@gnome.org> * glib/gtimer.c (g_time_val_from_iso8601): Fix the date validation check. (#503029) * tests/testglib.c (various_string_tests): Add an invalid date for testing the above fix. svn path=/trunk/; revision=6160
This commit is contained in:
committed by
Emmanuele Bassi
parent
28d1c8e0ad
commit
a979c0d5a2
@@ -1382,6 +1382,7 @@ various_string_tests (void)
|
||||
g_free (tmp_string);
|
||||
g_free (string);
|
||||
|
||||
#define REF_INVALID "Wed Dec 19 17:20:20 GMT 2007"
|
||||
#define REF_SEC_UTC 320063760
|
||||
#define REF_STR_UTC "1980-02-22T10:36:00Z"
|
||||
#define REF_STR_CEST "1980-02-22T12:36:00+02:00"
|
||||
@@ -1391,6 +1392,7 @@ various_string_tests (void)
|
||||
g_print ("checking g_time_val_from_iso8601...\n");
|
||||
ref_date.tv_sec = REF_SEC_UTC;
|
||||
ref_date.tv_usec = 0;
|
||||
g_assert (g_time_val_from_iso8601 (REF_INVALID, &date) == FALSE);
|
||||
g_assert (g_time_val_from_iso8601 (REF_STR_UTC, &date) != FALSE);
|
||||
if (g_test_verbose())
|
||||
g_print ("\t=> UTC stamp = %ld (should be: %ld) (%ld off)\n", date.tv_sec, ref_date.tv_sec, date.tv_sec - ref_date.tv_sec);
|
||||
|
Reference in New Issue
Block a user