Sponsored Content
Top Forums UNIX for Advanced & Expert Users Xt timer call, XtAppAddTimeout, hangs on system clock jump backwards Post 303020476 by altrefrain on Friday 20th of July 2018 12:44:33 PM
Old 07-20-2018
Question Xt timer call, XtAppAddTimeout, hangs on system clock jump backwards

Hi, I've got an issue which I've been 'google-fu'ing without much luck. We have a legacy program which has been plagued by an issue for a long time and I've been tasked to investigate/fix.

The program uses XMotif2.1 (required due to dependency on an old GUI designer) and runs on a RHEL7 machine (previously RHEL 5 and before that RHEL4). Normal GUI event processing relies on a re-entrant Xt callback using the XtAppAddTimeout call. This works fine, unless the system clock is set backwards, which occurs due during an NTP sync of the system (which can happen at any point during the program). When this occurs, it appears as though the program is frozen. According to my research, the way Xt handles timeouts is by determining the expiration time (system time + expiration interval) and waiting until that absolute time is reached, rather than using a monotonic clock. So, if the timer is waiting for a second to elapse, but during the wait the system time is set backwards by 18 minutes, the timer will wait for 18 minutes and 1 second before going off (i.e. reach the original expected expiration time).

I've found very little information on the web about others experiencing this issue and any suggestions for a solution. We've tried detecting the time jump in a separate thread and then attempting to cancel, via XtRemoveTimeout, and then restart the timer. But, we haven't had much luck. The best solution I've heard so far was to manage the timer outside the X event loop and use XtAppAddWorkProc instead.

This might be a long shot. But, does anyone have any experience with this that could provide some insight. TIA
 

10 More Discussions You Might Find Interesting

1. AIX

AIX 5.3 12 Hour System Clock

Hello Everyone, I have a Domino application running on AIX 5.3 that does time conversions worldwide. It uses the operating system time as a reference for the conversion. My problem is that I need the AIX OS clock to be a 12 hour clock (AM/PM) rather than a 24 hour clock. I have tried the date... (2 Replies)
Discussion started by: RTwitchell
2 Replies

2. UNIX for Dummies Questions & Answers

clock() call returning zero always

Hi, Is there a chance that the clock() call returns 0 eternally??? Using BSD. My RTOS application freezes inconsistently only on particular hosts. When debugging it, I came to see that the RTOS timer does not tick at times. The underlying system call is clock() & it always returns zero when the... (4 Replies)
Discussion started by: smanu
4 Replies

3. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

4. Programming

ABOUT RECV() SYSTEM CALL (regarding timer)

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any... (0 Replies)
Discussion started by: Rohil
0 Replies

5. Programming

Recv() call with timer(time out )

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any one knows... (2 Replies)
Discussion started by: Rohil
2 Replies

6. Shell Programming and Scripting

Sync Solaris System Clock With PDC Using Cron

Hi, I currently use the ntpdate and date command to sync the internal clock source of my Solaris systems to the primary domain controller. admin@myserver # ntpdate -d -u 192.168.???.??? 14 Jan 17:42:02 ntpdate: ntpdate 3-5.93e+sun 03/06/05 23:16:45 (1.4) transmit(192.168.???.???)... (2 Replies)
Discussion started by: jamba1
2 Replies

7. Solaris

System hangs

Hi, today when i started the OS Sun Solaris 10 it hangs on initialization. Following was shown in the end of the screen Initializing system Please wait.... * Please help? (3 Replies)
Discussion started by: malikshahid85
3 Replies

8. Solaris

System hangs (freezes) on system bell/beep

I am running OpenIndiana development version oi_148 32-bit on a seven-year-old Dell Inspiron 8600. Seems to be running fine except for one particular annoyance: It freezes whenever a system bell/beep plays. I have mitigated this by turning the system bell off in gnome-terminal, which I use... (3 Replies)
Discussion started by: DeadBadger
3 Replies

9. SCO

System Clock running at half speed

SCO Openserver 6.0.0 had an issue with a NIC losing it's config on reboot. Netconfig would not allow "view protocol" and apparently zeroed out the existing IP info. Repaired from console. After this event, however, the system clock seems to lose 30 seconds for every RTC minute that passes. As a... (1 Reply)
Discussion started by: DoublePanic
1 Replies

10. UNIX for Advanced & Expert Users

The UNIX clock/timer interrupt

The book The Design of the Unix Operating System speaks of a clock or timer that is used in scheduling. The clock generates interrupts that update priority information for processes and preempt processes in a round-robin fashion. It's apparent that this "clock" is not the same thing as the CPU... (1 Reply)
Discussion started by: Ultrix
1 Replies
TIMER_SETTIME(2)					     Linux Programmer's Manual						  TIMER_SETTIME(2)

NAME
timer_settime, timer_gettime - arm/disarm and fetch state of POSIX per-process timer SYNOPSIS
#include <time.h> int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec * old_value); int timer_gettime(timer_t timerid, struct itimerspec *curr_value); Link with -lrt. Feature Test Macro Requirements for glibc (see feature_test_macros(7)): timer_settime(), timer_gettime(): _POSIX_C_SOURCE >= 199309L DESCRIPTION
timer_settime() arms or disarms the timer identified by timerid. The new_value argument is pointer to an itimerspec structure that speci- fies the new initial value and the new interval for the timer. The itimerspec structure is defined as follows: struct timespec { time_t tv_sec; /* Seconds */ long tv_nsec; /* Nanoseconds */ }; struct itimerspec { struct timespec it_interval; /* Timer interval */ struct timespec it_value; /* Initial expiration */ }; Each of the substructures of the itimerspec structure is a timespec structure that allows a time value to be specified in seconds and nanoseconds. These time values are measured according to the clock that was specified when the timer was created by timer_create(2) If new_value->it_value specifies a nonzero value (i.e., either subfield is nonzero), then timer_settime() arms (starts) the timer, setting it to initially expire at the given time. (If the timer was already armed, then the previous settings are overwritten.) If new_value->it_value specifies a zero value (i.e., both subfields are zero), then the timer is disarmed. The new_value->it_interval field specifies the period of the timer, in seconds and nanoseconds. If this field is nonzero, then each time that an armed timer expires, the timer is reloaded from the value specified in new_value->it_interval. If new_value->it_interval specifies a zero value then the timer expires just once, at the time specified by it_value. By default, the initial expiration time specified in new_value->it_value is interpreted relative to the current time on the timer's clock at the time of the call. This can be modified by specifying TIMER_ABSTIME in flags, in which case new_value->it_value is interpreted as an absolute value as measured on the timer's clock; that is, the timer will expire when the clock value reaches the value specified by new_value->it_value. If the specified absolute time has already passed, then the timer expires immediately, and the overrun count (see timer_getoverrun(2)) will be set correctly. If the value of the CLOCK_REALTIME clock is adjusted while an absolute timer based on that clock is armed, then the expiration of the timer will be appropriately adjusted. Adjustments to the CLOCK_REALTIME clock have no effect on relative timers based on that clock. If old_value is not NULL, then it points to a buffer that is used to return the previous interval of the timer (in old_value->it_interval) and the amount of time until the timer would previously have next expired (in old_value->it_value). timer_gettime() returns the time until next expiration, and the interval, for the timer specified by timerid, in the buffer pointed to by curr_value. The time remaining until the next timer expiration is returned in curr_value->it_value; this is always a relative value, regardless of whether the TIMER_ABSTIME flag was used when arming the timer. If the value returned in curr_value->it_value is zero, then the timer is currently disarmed. The timer interval is returned in curr_value->it_interval. If the value returned in curr_value->it_interval is zero, then this is a "one-shot" timer. RETURN VALUE
On success, timer_settime() and timer_gettime() return 0. On error, -1 is returned, and errno is set to indicate the error. ERRORS
These functions may fail with the following errors: EFAULT new_value, old_value, or curr_value is not a valid pointer. EINVAL timerid is invalid. timer_settime() may fail with the following errors: EINVAL new_value.it_value is negative; or new_value.it_value.tv_nsec is negative or greater than 999,999,999. VERSIONS
These system calls are available since Linux 2.6. CONFORMING TO
POSIX.1-2001. EXAMPLE
See timer_create(2). SEE ALSO
timer_create(2), timer_getoverrun(2), time(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2012-10-15 TIMER_SETTIME(2)
All times are GMT -4. The time now is 06:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy