[glib: 6/8] GDate test: Disable Julian epoch test on Windows
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 6/8] GDate test: Disable Julian epoch test on Windows
- Date: Wed, 13 Feb 2019 10:40:52 +0000 (UTC)
commit 3ffa7ed0b6dccfa0368267807a4c8adfdd38be94
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Fri Feb 8 20:54:50 2019 +0000
GDate test: Disable Julian epoch test on Windows
Windows uses FILETIME, which starts counting from 1st Jan of year 1601 and,
unlike time_t, can't be negative, so Windows simply has no way
to do timestamp-math for dates before then. SYSTEMTIME (an equivalent
of struct tm) can, obviously, represent almost arbitrary date starting
from 1st Jan of year 0 (it's unsigned...), but GetDateFormatW() converts it
to FILETIME at some point in its implementation, and fails.
Unless the whole strftime() implementation of GDate is replaced by
something that doesn't rely on WinAPI, this part of the test will
never pass.
tests/testgdate.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/tests/testgdate.c b/tests/testgdate.c
index a8ec4cfe8..18022bc74 100644
--- a/tests/testgdate.c
+++ b/tests/testgdate.c
@@ -133,10 +133,13 @@ int main(int argc, char** argv)
g_date_set_julian(d, 1);
TEST("GDate's \"Julian\" epoch's first day is valid", g_date_valid(d));
+#ifndef G_OS_WIN32
g_date_strftime(buf,100,"Our \"Julian\" epoch begins on a %A, in the month of %B, %x\n",
d);
g_print("%s", buf);
-
+#else
+ g_print ("But Windows FILETIME does not support dates before Jan 1 1601, so we can't strftime() the
beginning of the \"Julian\" epoch.\n");
+#endif
g_date_set_dmy(d, 10, 1, 2000);
g_date_strftime(buf,100,"%x", d);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]