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
getitimer(2)							System Calls Manual						      getitimer(2)

NAME
getitimer(), setitimer() - get and set value of interval timer SYNOPSIS
DESCRIPTION
The function stores the current value of the timer specified by which into the structure pointed to by value. The function sets the timer specified by which to the value specified in the structure pointed to by value, and if ovalue is not a null pointer, stores the previous value of the timer in the structure pointed to by ovalue. The header declares the structure: If it_value is non-zero, it indicates the time to the next timer expiration. If it_interval is non-zero, it specifies a value to be used in reloading it_value when the timer expires. Setting it_value to 0 disables the timer, regardless of the value of it_interval. Setting it_interval to 0 disables the timer after its next expiration (assuming it_value is non-zero). Implementations may place limitations on the granularity of timer values. For each interval timer, if the requested timer value requires a finer granularity than the implementation supports, the actual timer value will be rounded up to the next supported value. Timer values smaller than the resolution of the system clock are rounded up to this resolution. The machine-dependent clock resolution is seconds, where the constant is defined in To make sure that a process gets at least as much time as requested, the timer value is rounded up to the next timer tick (a timer tick is the smallest supported value). The timer value is rounded up to the next timer tick, because the timer may be initialized somewhere between timer ticks. If a is followed by a without a timer tick in between, it is possible that the value returned by may be more than the initial value requested by due to this rounding. Implementations may place limitations on the timer value. Timer values larger than an implementation-specific maximum value are rounded down to this maximum. The maximum values for the three interval timers are specified by the constants and defined in On all implementa- tions, these values are guaranteed to be at least 31 days (in seconds). An XSI-conforming implementation provides each process with at least three interval timers, which are indicated by the which argument: Decrements in real time. A signal is delivered to the process when this timer expires. Decrements in process virtual time. This timer runs only when the process is executing. A signal is delivered to the process when the timer expires. Decrements both in process virtual time and when the system is running on behalf of the process. This timer is designed to be used by interpreters in sta- tistically profiling the execution of interpreted programs. Each time the timer expires, a signal is delivered to the process. In addition to the above timers, HP-UX provides the following three per-thread interval timers for threads, which are indicated by the which argument: Decrements in real time. A signal is delivered to the thread which set this timer when the timer expires. Decrements in thread virtual time. This timer runs only when the thread is executing. A signal is delivered to the thread which set this timer when the timer expires. Decrements both in thread virtual time and when the system is running on behalf of the thread. Each time the timer expires, a signal is delivered to the thread which set this timer. Since a signal can interrupt in-progress system calls, programs using this timer must be prepared to restart the interrupted system call. Interval timers are not inherited by a child process across a but are inherited across an Three macros for manipulating time values are defined in Set a time value to zero. Test if a time value is non-zero. Compare two time values. (Beware that and do not work with the macro.) The timer used with is also used by (see alarm(2)). Thus successive calls to and set and return the state of a single timer. In addition, a call to sets the timer interval to zero. The interaction between and any of or is unspecified. RETURN VALUE
Upon successful completion, or returns 0. Otherwise, -1 is returned and is set to indicate the error. ERRORS
The function will fail if: The value argument is not in canonical form. (In canonical form, the number of microseconds is a non-negative integer less than 1,000,000 and the number of seconds is a non-negative integer.) The and functions may fail if: The which argument is not recognized. The value structure specified a bad address. Reliable detection of this error is implementation dependent. EXAMPLES
The following call to sets the real-time interval timer to expire initially after 10 seconds and every 0.5 seconds thereafter: AUTHOR
was developed by the University of California, Berkeley. SEE ALSO
alarm(2), exec(2), ualarm(2), usleep(2), pthread_attr_setscope(3T), pthread_create(3T), pthread_sigmask(3T), sleep(3C), signal(5). CHANGE HISTORY
First released in Issue 4, Version 2. getitimer(2)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy