Once we get the code base somewhat nailed down, I'll take a stab at writing
unit tests for the sets of existing code that don't have test cases.  Has
anyone gotton in touch with the Ant folks and asked about copying/moving
some of their good time code over?

Eric

-----Original Message-----
From: Sean Schofield [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 13, 2002 3:16 PM
To: Jakarta Commons Developers List
Subject: Re: [lang] Has anyone thought about a TimeUtils package?


I agree that simple time/date utilities would belong in commons/lang as 
opposed to a larger project like joda.  This is infact what I had in 
mind.  I will also keep in mind the potential controversey as suggested.

Here are a few scenarios that I'd like to throw out there as possibly 
being general enough (and not already solved by another jakarta effort 
or the JDK itself):

Scenario 1:

We have several remote clients who connect to our system over the 
Internet.  The client program itself is only supposed to be in operation 
during a scheduled time interval.  If your "session" begins at 13:00 
(ignore time zones for now) and is 60 minutes long, then the client 
should terminate itself (with an explanation provided to the GUI) at 
14:00.  We can't just use a simple timer of 60 minutes b/c we can't 
guarantee the time that the user will enter (if they show up at all!) 
 We can't rely on the user's system clock b/c they may be off by 
minutes, months or even years!

Solution:

I wrote a utility that is initialized with a time provided by the server 
(which we know is correct).  It then compares this time to the user's 
system time and stores the difference.  From that point on you can ask 
the utility for the "adjusted time."  This isn't exact but the result 
should only be a few miliseconds which usually isn't important in these 
types of situations.

Scenario 2:

The user needs to see their session schedule from a JSP page.  In the 
database we have a timezone stored so we know what timezone they are in.  

Solution:

I wrote a utility that can display the schedule date/time in a specified 
timezone (as well as current date time) with a single method call where 
you provide the timezone (and some overloaded methods with basic formats 
to choose from).

Anyways these are two examples of the types of small utilities that 
might be nice to have in a TimeUtils or CalendarUtils or whatever class 
in commons-lang.  What do people think about these specific examples and 
what about the idea of pooling these and some of the others mentioned 
(in rupert, ant, velocity, etc.) into a single spot in commons-lang?  We 
could start it off in sandbox and see where it goes?

- sean


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

Reply via email to