Commit ebecd56d by Andreas Tobler Committed by Tom Tromey

configure, [...]: Rebuilt.

2002-01-06 Andreas Tobler <a.tobler@schweiz.ch>

	* configure, include/config.h.in: Rebuilt.
	* java/lang/natSystem.cc (getSystemTimeZone): Check HAVE_TM_ZONE.
	* configure.in: Call AC_STRUCT_TIMEZONE.

From-SVN: r48588
parent 0b34d6fa
2002-01-06 Andreas Tobler <a.tobler@schweiz.ch>
* configure, include/config.h.in: Rebuilt.
* java/lang/natSystem.cc (getSystemTimeZone): Check HAVE_TM_ZONE.
* configure.in: Call AC_STRUCT_TIMEZONE.
2002-01-02 Andreas Tobler <a.tobler@schweiz.ch>
* configure.host: Disable the interpreter for Darwin.
......
......@@ -450,6 +450,7 @@ else
AC_DEFINE(HAVE_PROC_SELF_EXE)])
AM_ICONV
AC_STRUCT_TIMEZONE
AC_CHECK_FUNCS(gethostbyname_r, [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
......
......@@ -13,6 +13,13 @@
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
......@@ -25,6 +32,9 @@
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
......
// natSystem.cc - Native code implementing System class.
/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
/* Copyright (C) 1998, 1999, 2000, 2001 , 2002 Free Software Foundation
This file is part of libgcj.
......@@ -242,8 +242,9 @@ java::lang::System::getSystemTimeZone (void)
{
struct tm *tim;
time_t current_time;
char **tzinfo, *tzid;
long tzoffset;
const char *tz1, *tz2;
char *tzid;
current_time = time(0);
......@@ -259,34 +260,28 @@ java::lang::System::getSystemTimeZone (void)
// is available, esp. if tzname is valid.
// Richard Earnshaw <rearnsha@arm.com> has suggested using difftime to
// calculate between gmtime and localtime (and accounting for possible
// daylight savings time) as an alternative. Also note that this same
// issue exists in java/util/natGregorianCalendar.cc.
// daylight savings time) as an alternative.
tzoffset = 0L;
#endif
tzinfo = tzname;
#ifdef HAVE_TM_ZONE
tz1 = tim->tm_zone;
tz2 = "";
#elif defined (HAVE_TZNAME)
tz1 = tzname[0];
tz2 = strcmp (tzname[0], tzname[1]) ? tzname[1] : "";
#else
#error Neither tm_zone nor tzname defined
#endif
if ((tzoffset % 3600) == 0)
tzoffset = tzoffset / 3600;
if (!strcmp(tzinfo[0], tzinfo[1]))
{
tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + 6);
if (!tzid)
return NULL;
sprintf(tzid, "%s%ld", tzinfo[0], tzoffset);
}
else
{
tzid = (char*) _Jv_Malloc (strlen(tzinfo[0]) + strlen(tzinfo[1]) + 6);
if (!tzid)
return NULL;
sprintf(tzid, "%s%ld%s", tzinfo[0], tzoffset, tzinfo[1]);
}
tzid = (char*) _Jv_Malloc (strlen(tz1) + strlen(tz2) + 6);
sprintf(tzid, "%s%ld%s", tz1, tzoffset, tz2);
jstring retval = JvNewStringUTF (tzid);
_Jv_Free (tzid);
return retval;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment