Hi!

In my case the system-time updates come from the NTP-client of the system.
So it has nothing to do with Joda (very off-topic here) but with the raised
question.

The special situation is the first run of a server which gets installed
somewhere and was delivered with a wrong time. If the java-app is already
running and the NTP-client makes an update, all Thread.sleep() hang.
Although it's a rare situation it lead me to use wait() instead.

lukas


Am Donnerstag, 15. Februar 2007 13:20 schrieb Stephen Colebourne:
> My question would be why are you changing the system time?
>
> Joda-Time supports the ability to change the apparent system time.
> Simply use DateTimeUtils.currentTimeMillis() instead of
> System.currentTimeMillis(). There are methods to change the time
> programmatically on DateTimeUtils.
>
> Stephen
>
> On 15/02/07, Adrian Sandor <[EMAIL PROTECTED]> wrote:
> > Hi, thanks for the reply.
> > I had tried Object.wait() too, and it still didn't work well for me.
> > However, now I decided to test it more, and it looks like the Eclipse
> > console was the one getting confused; it worked fine from a shell. I'll
> > try using this method in my main project and see how it works.
> >
> > Thanks and regards,
> > Adrian
> >
> > ----- Original Message ----
> > From: Lukas Ruetz <[EMAIL PROTECTED]>
> > To: Discussion of the Joda project
> > <[email protected]>
> > Sent: Thursday, February 15, 2007 6:50:37 PM
> > Subject: Re: [Joda-interest] Changing system time
> >
> > Hi!
> >
> > Am Donnerstag, 15. Februar 2007 11:11 schrieb Adrian Sandor:
> > > Hi, I'm not using joda-time yet, but may start soon.
> > > Have you guys found a solution to the problem of timers getting
> > > confused
> >
> > by
> >
> > > changes in the system time? All the timers and sleep/wait methods I
> > > tried have failed to work properly when I changed my computer's time.
> > > This is on linux, kernel 2.6.19, and Sun JDK 1.5.0_10
> > >
> > > Adrian
> >
> > I had this problem too.
> >
> > Fact is, that this is a problem of the JVM under linux. Therad.sleep()
> > does not return if the system time is set to a time in the past.
> > The solution for me was to use Object.wait() (on a simple Object())
> > instead of Therad.sleep() calls. wait() always returned.
> >
> > I don't use any timer, but they will use Thread.sleep() I guess and so
> > have the same problem.
> >
> > You will find many bug-reports on the sun homepage to that topic.
> >
> > hth,
> > lukas

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to