if (g_test_verbose())
{
-#ifdef G_PLATFORM_WIN32
- gchar *glib_dll;
-#endif
const gchar *charset;
if (g_get_charset ((G_CONST_RETURN char**)&charset))
g_print ("current charset is UTF-8: %s\n", charset);
g_print ("current charset is not UTF-8: %s\n", charset);
#ifdef G_PLATFORM_WIN32
-#ifdef G_OS_WIN32
- /* Can't calculate GLib DLL name at runtime. */
- glib_dll = "libglib-2.0-0.dll";
-#endif
-#ifdef G_WITH_CYGWIN
- glib_dll = "cygglib-2.0-0.dll";
-#endif
-
g_print ("current locale: %s\n", g_win32_getlocale ());
- g_print ("GLib DLL name tested for: %s\n", glib_dll);
-
- g_print ("GLib installation directory, from Registry entry for %s if available: %s\n",
- GETTEXT_PACKAGE,
- g_win32_get_package_installation_directory (GETTEXT_PACKAGE, NULL));
- g_print ("Ditto, or from GLib DLL name: %s\n",
- g_win32_get_package_installation_directory (GETTEXT_PACKAGE, glib_dll));
- g_print ("Ditto, only from GLib DLL name: %s\n",
- g_win32_get_package_installation_directory (NULL, glib_dll));
- g_print ("locale subdirectory of GLib installation directory: %s\n",
- g_win32_get_package_installation_subdirectory (NULL, glib_dll, "lib\\locale"));
- g_print ("GTK+ 2.0 installation directory, if available: %s\n",
- g_win32_get_package_installation_directory ("gtk20", NULL));
g_print ("found more.com as %s\n", g_find_program_in_path ("more.com"));
g_print ("found regedit as %s\n", g_find_program_in_path ("regedit"));
GTimeVal ref_date, date;
gchar *tmp_string = NULL, *tmp_string_2, *string, *date_str;
guint i;
+ const gchar *tz;
if (g_test_verbose())
g_print ("checking string chunks...");
#define REF_INVALID2 "1980-02-22T10:36:00Zulu"
#define REF_SEC_UTC 320063760
#define REF_STR_UTC "1980-02-22T10:36:00Z"
+#define REF_STR_LOCAL "1980-02-22T13:36:00"
#define REF_STR_CEST "1980-02-22T12:36:00+02:00"
#define REF_STR_EST "19800222T053600-0500"
#define REF_STR_NST "1980-02-22T07:06:00-03:30"
date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
+ /* predefine time zone */
+ tz = g_getenv("TZ");
+ g_setenv("TZ", "UTC-03:00", 1);
+ tzset();
+
+ g_assert (g_time_val_from_iso8601 (REF_STR_LOCAL, &date) != FALSE);
+ if (g_test_verbose())
+ g_print ("\t=> LOCAL stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",
+ date.tv_sec, date.tv_usec, ref_date.tv_sec, ref_date.tv_usec,
+ date.tv_sec - ref_date.tv_sec, date.tv_usec - ref_date.tv_usec);
+ g_assert (date.tv_sec == ref_date.tv_sec && date.tv_usec == ref_date.tv_usec);
+
+ /* revert back user defined time zone */
+ if (tz)
+ g_setenv("TZ", tz, TRUE);
+ else
+ g_unsetenv("TZ");
+ tzset();
+
g_assert (g_time_val_from_iso8601 (REF_STR_CEST, &date) != FALSE);
if (g_test_verbose())
g_print ("\t=> CEST stamp = %ld.%06ld (should be: %ld.%06ld) (%ld.%06ld off)\n",