[kaffe] CVS kaffe (guilhem): Again a fix for Solaris.
Kaffe CVS
cvs-commits at kaffe.org
Sat Jul 17 08:37:18 PDT 2004
PatchSet 4981
Date: 2004/07/17 15:33:33
Author: guilhem
Branch: HEAD
Tag: (none)
Log:
Again a fix for Solaris.
2004-07-17 Riccardo Mottola <rmottola at users.sf.net>
* libraries/clib/native/TimeZone.c
(java_util_TimeZone_getDefaultTimeZoneId):
The old code has been put back again because some
architectures does not implement tm_zone.
Members:
ChangeLog:1.2545->1.2546
libraries/clib/native/TimeZone.c:1.2->1.3
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2545 kaffe/ChangeLog:1.2546
--- kaffe/ChangeLog:1.2545 Sat Jul 17 13:55:59 2004
+++ kaffe/ChangeLog Sat Jul 17 15:33:33 2004
@@ -1,3 +1,10 @@
+2004-07-17 Riccardo Mottola <rmottola at users.sf.net>
+
+ * libraries/clib/native/TimeZone.c
+ (java_util_TimeZone_getDefaultTimeZoneId):
+ The old code has been put back again because some
+ architectures does not implement tm_zone.
+
2004-07-17 Guilhem Lavaux <guilhem at kaffe.org>
* configure.ac: Added a new test to check whether tm_zone exists in
Index: kaffe/libraries/clib/native/TimeZone.c
diff -u kaffe/libraries/clib/native/TimeZone.c:1.2 kaffe/libraries/clib/native/TimeZone.c:1.3
--- kaffe/libraries/clib/native/TimeZone.c:1.2 Fri Jul 16 16:21:04 2004
+++ kaffe/libraries/clib/native/TimeZone.c Sat Jul 17 15:33:37 2004
@@ -1,11 +1,19 @@
/*
* java.util.TimeZone.c
*
- * Copyright (c) 2003
- * Kaffe's team.
+ * Copyright (c) 2003, 2004
+ * The Kaffe.org's team.
*
* See the file "license.terms" for information on usage and redistribution
* of this file.
+ *
+ * PORTABILITY NOTES
+ * tm->tm_zone is the preferred way to access time zone name
+ * on other sytem the use of the external
+ * extern char *tzname[]
+ * is attempted.
+ * On some systems the external symbol is present in the libc but is not exported in the headers
+ * I suggest in that case to put it in the respective md.h of that platform.
*/
#include "config.h"
#include "config-std.h"
@@ -15,17 +23,18 @@
struct Hjava_lang_String*
java_util_TimeZone_getDefaultTimeZoneId(void)
{
-#ifdef HAVE_TIME_H
- struct tm *tempTimeStruct;
- time_t tempTimeArithm;
- char *tempZoneName;
+ char *tempZoneName = NULL;
+#ifdef HAVE_DECLARED_TM_ZONE
+ struct tm *tempTimeStruct;
+ time_t tempTimeArithm;
- tempTimeArithm = 0;
- tempTimeStruct = localtime (&tempTimeArithm);
- tempZoneName = tempTimeStruct->tm_zone;
- assert(tempZoneName != NULL);
- return stringC2Java(tempZoneName);
+ tempTimeArithm = 0;
+ tempTimeStruct = localtime (&tempTimeArithm);
+ tempZoneName = tempTimeStruct->tm_zone;
#else
- return NULL;
+ tzset();
+ tempZoneName = tzname[0]; /* read above for this external symbol */
#endif
+ assert(tempZoneName != NULL);
+ return stringC2Java(tempZoneName);
}
More information about the kaffe
mailing list