ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject Re: Problem with latest Selector patch?
Date Tue, 09 Jul 2002 18:16:28 GMT

----- Original Message -----
From: "Bruce Atherton" <bruce@callenish.com>
To: "Ant Developers List" <ant-dev@jakarta.apache.org>
Sent: Tuesday, July 09, 2002 10:41 AM
Subject: Re: Problem with latest Selector patch?


> At 02:22 PM 7/9/2002 +0200, Stefan Bodewig wrote:
> >On 09 Jul 2002, Stefan Bodewig <bodewig@apache.org> wrote:
> >
> > > Locale?
> >
> >Seems to be the case:
>
> Doh! Thanks a lot, Stefan, that is exactly the problem. My timezone is
> Pacific Daylight (GMT-7:00).
>
> I'm guessing the issue is that setting the date through the <touch> task
is
> adjusted for timezone, whereas the value returned by lastModifiedTime() is
> not. I guess anything that parses date strings should support the same
type
> of information that <tstamp> does.

the time you get by lastModifiedTime should be in the same TZ as
currentTimeMillis(). I know that because my server heath checks (relevant
snippets attached) verify that the clock in the filestore is within a few
minutes of the local clock, that being a requirement for the housekeeping
thread to not delete files the moment they are created. On server clusters,
if the fileserver was set to GMT and the app server on PST, we saw about 8
hours of separation, which was a bad thing.

 public long getTimeDifference(Store store)
  throws IOException {
  StoreReference target = store.createReference("tmp");
  File file = target.getFile();
  long hereandnow = System.currentTimeMillis();
  file.createNewFile();
  long thereandthen = file.lastModified();
  file.delete();
  return hereandnow - thereandthen;
 }

 public void testServerClockTimes()
  throws Exception {
  long offset = getTimeDifference(_context.getStore());
  Log.debug("offset is " + offset);
  if (offset < 0) {
   offset = -offset;
  }
  if (offset > max_time_difference) {
   fail("the time difference between system and filestore is too high");
  }
 }




--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message