GDateTime *datetime;
gint64 full_time;
+ if (year < 1 || year > 9999 ||
+ month < 1 || month > 12 ||
+ day < 1 || day > 31 ||
+ hour < 0 || hour > 23 ||
+ minute < 0 || minute > 59 ||
+ seconds < 0.0 || seconds >= 60.0)
+ return NULL;
+
datetime = g_date_time_alloc (tz);
datetime->days = ymd_to_days (year, month, day);
datetime->usec = (hour * USEC_PER_HOUR)
g_date_time_unref (dt);
}
+static void
+test_GDateTime_invalid (void)
+{
+ GDateTime *dt;
+
+ g_test_bug ("702674");
+
+ dt = g_date_time_new_utc (2013, -2147483647, 31, 17, 15, 48);
+ g_assert (dt == NULL);
+}
+
static void
test_GDateTime_compare (void)
{
g_test_bug ("642935");
tz = g_time_zone_new ("-08:00");
- dt = g_date_time_new (tz, 0, 0, 0, 0, 0, 0);
+ dt = g_date_time_new (tz, 1, 1, 1, 0, 0, 0);
p = g_date_time_format (dt, "%z");
g_assert_cmpstr (p, ==, "-0800");
g_date_time_unref (dt);
/* GDateTime Tests */
+ g_test_add_func ("/GDateTime/invalid", test_GDateTime_invalid);
g_test_add_func ("/GDateTime/add_days", test_GDateTime_add_days);
g_test_add_func ("/GDateTime/add_full", test_GDateTime_add_full);
g_test_add_func ("/GDateTime/add_hours", test_GDateTime_add_hours);