Qt-interest Archive, July 2007
QTimer Problem
Message 1 in thread
Hello,
I am facing a problem with QTimer.
The timer times-out as soon as it is started. This happens only when the current system date/time is changed by another process simultaneously.
I am giving someTimer->start(4000,true); command. But it times-out immediately when the system date/time is changed parallely by another process.
Is this a bug with qtimer ?
I am using qt 3.3.6 version.
- Navneet Kataria
---------------------------------
Pinpoint customers who are looking for what you sell.
Message 2 in thread
hi,
There is no any problem with qtimer. I think your problem is , when u start
your timer for 4 sec, and at the same time your another process changed your
system time by adding 4 sec to your system time , your qtimer elapsed
immeditely....
what is your actual objective????
Regards,
Niranjan.
On Thursday 12 July 2007 14:17, Navneet Kataria wrote:
> Hello,
>
> I am facing a problem with QTimer.
> The timer times-out as soon as it is started. This happens only when the
> current system date/time is changed by another process simultaneously.
>
> I am giving someTimer->start(4000,true); command. But it times-out
> immediately when the system date/time is changed parallely by another
> process. Is this a bug with qtimer ?
> I am using qt 3.3.6 version.
>
>
>
> - Navneet Kataria
>
>
>
>
>
>
>
> ---------------------------------
> Pinpoint customers who are looking for what you sell.
--
[ signature omitted ]
Message 3 in thread
Hi,
The actual object is to make a dialog box for changing system date/time in linux. The dialog box for changing system date/time should disappear it-self if the user has not responded with-in 2 mintues.
This thing I am trying to achieve using the program listed in the previous thread.
http://lists.trolltech.com/qt-interest/2007-07/thread00324-0.html
I am using QTimer for checking the elasp of 2 mintues without user activity. If I detect any user-event, I restart the timer. And timeout of the timer object is connected to close event of the dialog.
The program works fine if I change date/time in future. But if date/time is changed back in past, the form disappears because of the false time-out fired by qtimer.
Niranjan <niranjank@xxxxxxxxxxxx> wrote: hi,
There is no any problem with qtimer. I think your problem is , when u start
your timer for 4 sec, and at the same time your another process changed your
system time by adding 4 sec to your system time , your qtimer elapsed
immeditely....
what is your actual objective????
Regards,
Niranjan.
On Thursday 12 July 2007 14:17, Navneet Kataria wrote:
> Hello,
>
> I am facing a problem with QTimer.
> The timer times-out as soon as it is started. This happens only when the
> current system date/time is changed by another process simultaneously.
>
> I am giving someTimer->start(4000,true); command. But it times-out
> immediately when the system date/time is changed parallely by another
> process. Is this a bug with qtimer ?
> I am using qt 3.3.6 version.
>
>
>
> - Navneet Kataria
>
>
>
>
>
>
>
> ---------------------------------
> Pinpoint customers who are looking for what you sell.
--
[ signature omitted ]
Message 4 in thread
hi,
try with alarm...
Reagrds,
Niranjan
On Thursday 12 July 2007 21:36, Navneet Kataria wrote:
> Hi,
>
> The actual object is to make a dialog box for changing system date/time in
> linux. The dialog box for changing system date/time should disappear
> it-self if the user has not responded with-in 2 mintues.
>
> This thing I am trying to achieve using the program listed in the previous
> thread. http://lists.trolltech.com/qt-interest/2007-07/thread00324-0.html
>
> I am using QTimer for checking the elasp of 2 mintues without user
> activity. If I detect any user-event, I restart the timer. And timeout of
> the timer object is connected to close event of the dialog. The program
> works fine if I change date/time in future. But if date/time is changed
> back in past, the form disappears because of the false time-out fired by
> qtimer.
>
> Niranjan <niranjank@xxxxxxxxxxxx> wrote: hi,
>
> There is no any problem with qtimer. I think your problem is , when u start
> your timer for 4 sec, and at the same time your another process changed
> your system time by adding 4 sec to your system time , your qtimer elapsed
> immeditely....
>
> what is your actual objective????
>
> Regards,
> Niranjan.
>
> On Thursday 12 July 2007 14:17, Navneet Kataria wrote:
> > Hello,
> >
> > I am facing a problem with QTimer.
> > The timer times-out as soon as it is started. This happens only when the
> > current system date/time is changed by another process simultaneously.
> >
> > I am giving someTimer->start(4000,true); command. But it times-out
> > immediately when the system date/time is changed parallely by another
> > process. Is this a bug with qtimer ?
> > I am using qt 3.3.6 version.
> >
> >
> >
> > - Navneet Kataria
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Pinpoint customers who are looking for what you sell.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
>
>
>
>
> - Navneet Kataria
>
>
>
>
>
>
>
> ---------------------------------
> The fish are biting.
> Get more visitors on your site using Yahoo! Search Marketing.
--
[ signature omitted ]
Message 5 in thread
i didn't get the idea !
What is alarm in Qt ?
But I *strongly* feel that it is a bug with QTimer.
I face this problem with Qthread::msleep also. I solved that by using sleep function provided by unistd.h.
In Qt they are using gettimeofday function and adding the interval to the gettimeofday return value. All is fine except i think they are not taking care of the case when the time is changed between gettimeofday function call and adding the interval to it and waiting for the time to expire.
Niranjan <niranjank@xxxxxxxxxxxx> wrote: hi,
try with alarm...
Reagrds,
Niranjan
On Thursday 12 July 2007 21:36, Navneet Kataria wrote:
> Hi,
>
> The actual object is to make a dialog box for changing system date/time in
> linux. The dialog box for changing system date/time should disappear
> it-self if the user has not responded with-in 2 mintues.
>
> This thing I am trying to achieve using the program listed in the previous
> thread. http://lists.trolltech.com/qt-interest/2007-07/thread00324-0.html
>
> I am using QTimer for checking the elasp of 2 mintues without user
> activity. If I detect any user-event, I restart the timer. And timeout of
> the timer object is connected to close event of the dialog. The program
> works fine if I change date/time in future. But if date/time is changed
> back in past, the form disappears because of the false time-out fired by
> qtimer.
>
> Niranjan wrote: hi,
>
> There is no any problem with qtimer. I think your problem is , when u start
> your timer for 4 sec, and at the same time your another process changed
> your system time by adding 4 sec to your system time , your qtimer elapsed
> immeditely....
>
> what is your actual objective????
>
> Regards,
> Niranjan.
>
> On Thursday 12 July 2007 14:17, Navneet Kataria wrote:
> > Hello,
> >
> > I am facing a problem with QTimer.
> > The timer times-out as soon as it is started. This happens only when the
> > current system date/time is changed by another process simultaneously.
> >
> > I am giving someTimer->start(4000,true); command. But it times-out
> > immediately when the system date/time is changed parallely by another
> > process. Is this a bug with qtimer ?
> > I am using qt 3.3.6 version.
> >
> >
> >
> > - Navneet Kataria
> >
> >
> >
> >
> >
> >
> >
> > ---------------------------------
> > Pinpoint customers who are looking for what you sell.
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
>
>
>
>
> - Navneet Kataria
>
>
>
>
>
>
>
> ---------------------------------
> The fish are biting.
> Get more visitors on your site using Yahoo! Search Marketing.
--
[ signature omitted ]
Message 6 in thread
Hi,
> I am facing a problem with QTimer.
> The timer times-out as soon as it is started. This happens only when the
> current system date/time is changed by another process simultaneously.
This is a known issue with QTimer. QTimer is not a monotonic timer.
I think QTimer support for monotonic timers has been added to Qt 4.3:
http://trolltech.com/developer/notes/changes/changes-4.3.0/
[96507] Added support for using _POSIX_MONOTONIC_CLOCK as the
timer source (also affects Qtopia Core).
--
[ signature omitted ]
Message 7 in thread
Hi,
Thanks for the response. I downloaded Qt 4.3 version and tried the small program. It worked. So the problem was because of non-monotonic timers.
But I am working on a relatively medium size project. Porting the whole project to Qt 4.3 would take a lot of effort and time. Is there a work-around possible for this problem of QTimers in Qt 3.xx version ? I worked-around the similar problem in QThread::msleep by using sleep function provided in unistd.h (on Gnu/Linux).
thanks and regards,
Navneet Kataria
Dimitri <dimitri@xxxxxxxxxxxxx> wrote: Hi,
> I am facing a problem with QTimer.
> The timer times-out as soon as it is started. This happens only when the
> current system date/time is changed by another process simultaneously.
This is a known issue with QTimer. QTimer is not a monotonic timer.
I think QTimer support for monotonic timers has been added to Qt 4.3:
http://trolltech.com/developer/notes/changes/changes-4.3.0/
[96507] Added support for using _POSIX_MONOTONIC_CLOCK as the
timer source (also affects Qtopia Core).
--
[ signature omitted ]