This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libjava configuration problems

On 24 Jan 2001, Tom Tromey wrote:

> >>>>> "Richard" == Richard Earnshaw <> writes:
> Richard> Actually, this is wrong, the test did fail.  So why does
> Richard> still try to use 'timezone'?
> It didn't used to.  However, Warren's rewrite the timezone code seems
> to have changed this.
> Warren, can you look into this?  I don't recall what the old code did
> (but I'm sure cvs does :-), but it is definitely important to use the
> results of configure.

Actually, nothing changed; it has been this way (even when the code was in
java/util/  I wrote that code when I converted the
corresponding JNI code in Classpath to a CNI routine.  Classpath doesn't
seem to check for this issue.

Richard, I think the attached patch will do the trick.  It builds and
doesn't cause any regressions on my x86 linux box.  Please see if it takes
care of the problem on yours.

If it does (and since it fixes a build/portability issue), I assume it
would be a good patch to commit even while the tree is "slushy".  As I am
new to the GCC project rules (since libgcj is a relatively new component),
if this is a bad assumption, someone please slap me on the wrist asap ;-).
RCS file: /cvs/gcc/egcs/libjava/java/lang/,v
retrieving revision 1.33
diff -u -p -r1.33
---	2001/01/12 19:16:05	1.33
+++	2001/01/26 02:25:36
@@ -240,15 +240,24 @@ getpwuid_adaptor(T_passwd * (*getpwuid_r
 java::lang::System::getSystemTimeZone (void)
+  struct tm *tim;
   time_t current_time;
   char **tzinfo, *tzid;
   long tzoffset;
   current_time = time(0);
-  mktime(localtime(&current_time));
+  mktime(tim = localtime(&current_time));
+  tzoffset = -(tim->tm_gmtoff);	// tm_gmtoff is secs EAST of UTC.
+  tzoffset = timezone;		// timezone is secs WEST of UTC.
+  // FIXME: there must be another global if neither tm_gmtoff nor timezone
+  // is available, esp. if tzname is valid.
+  tzoffset = 0;		
   tzinfo = tzname;
-  tzoffset = timezone;
   if ((tzoffset % 3600) == 0)
     tzoffset = tzoffset / 3600;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]