GregorianCalendar fixes

Dalibor Topic robilad@kaffe.org
Sat Nov 29 19:15:00 GMT 2003


Hi Ito,

after the discussion on the Classpath mailing list, I'd say it looks good ;)

Mark, can I check it into Classpath's CVS with an updated ChangeLog entry?

2003-11-29  Guilhem Lavaux <guilhem@kaffe.org>

  	* java/util/GregorianCalendar.java (computeTime):
  	12:00 midnight is AM and 12:00 noon is PM.

cheers,
dalibor topic

Ito Kazumitsu wrote:
> Hi,
> 
> 
>>>>>>":" == Mark Wielaard <mark@klomp.org> writes:
> 
> 
> :> Looked some more at the code and I see now that the the first change was
> :> inside a if (time >= gregorianCutover) so it now makes more sense to me.
> :> And the second change seems correct given the above remark.
> :> I'll commit it in Classpath.
> 
> There is another difference between GNU Classpath's
> java/util/GregorianCalendar.java and that of kaffe.
> 
> Kaffe's was imported from GNU Classpath and modified
> in the kaffe world, as described by the following
> ChangeLog entry.
> 
> 2003-08-16  Guilhem Lavaux <guilhem@kaffe.org>
> 
> 	* java/util/GregorianCalendar.java (computeTime):
> 	12:00 midnight is AM and 12:00 noon is PM.
> 
> Here is the patch that can be applied to Revision 1.21:
> 
> --- java/util/GregorianCalendar.java.orig	Thu Nov 27 15:35:08 2003
> +++ java/util/GregorianCalendar.java	Thu Nov 27 15:48:25 2003
> @@ -402,7 +402,11 @@
>        {
>  	hour = fields[HOUR];
>          if (isSet[AM_PM] && fields[AM_PM] == PM)
> -	  hour += 12;
> +	  if (hour != 12) /* not Noon */
> +            hour += 12;
> +	/* Fix the problem of the status of 12:00 AM (midnight). */
> +	if (isSet[AM_PM] && fields[AM_PM] == AM && hour == 12)
> +	  hour = 0;
>        }
>  
>      int minute = isSet[MINUTE] ? fields[MINUTE] : 0;



More information about the Java-patches mailing list