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(3)					     Library Functions Manual						  timer_settime(3)

NAME
timer_settime, timer_gettime - Obtains or sets the expiration time of the specified per-process timer (P1003.1b) LIBRARY
Realtime Library (librt.so, librt.a) SYNOPSIS
#include <time.h> int timer_gettime ( timer_t timerid, struct itimerspec *value); int timer_settime ( timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue); PARAMETERS
timerid Specifies the timer ID for the timer whose expiration time is set or returned. flags Specifies whether the timer is to be an absolute or relative timer. *value Specifies a pointer to an itimerspec data structure. *ovalue Specifies a pointer to the itimerspec data structure into which the time remaining on the previous timer is returned. DESCRIPTION
The timer_gettime function returns the amount of time remaining in the current time interval before the expiration of the specified timer. The timer_settime function sets the expiration time of the specified per-process timer, determines whether the timer is an absolute or rel- ative timer, returns the time remaining (if any) on the previous specified timer, and arms the timer. Both the timer_gettime and timer_settime functions use an itimerspec structure, which consists of the following members: struct timespec it_interval; struct timespec it_value; Each timespec structure consists of the following members: time_t tv_sec; long tv_nsec; Values specified for these members determine the duration of the timer intervals, as well as the start and end times. Use the timer_gettime function to determine whether a per-process timer is still active. If the timer is disabled, zero is returned. The timer_settime function sets the expiration time of the specified per-process timer and arms the timer. The TIMER_ABSTIME flag deter- mines whether the timer is an absolute or relative timer. If the TIMER_ABSTIME flag is not set (flags=0), the timer is set relative to the current time (a relative timer). In this case, the time until the next timer expiration equals the interval specified by the it_value mem- ber of value. The timer expires in the specified number of seconds and nanoseconds from when the call was made. If the TIMER_ABSTIME flag is set, the timer is set with a specified starting time (an absolute timer). In this case, the time until the next timer expiration equals the difference between the absolute time specified by the it_value member of value and the current value of the clock associated with the timer ID. The timer expires when the clock reaches the value specified by it_value member. Times that are between two consecutive non-negative integer multiples of the resolution are rounded up to the larger multiple of the reso- lution. To disarm a timer, specify a value of 0 (zero) for the it_value member and call the timer_settime function. The reload value to the timer is set to the value specified by the it_interval member of value. If the it_interval is zero, a one-shot timer is specified. If the it_interval is non-zero, a periodic timer is specified. RETURN VALUES
On a successful call to the timer_gettime and timer_settime functions, a value of 0 (zero) is returned. On an unsuccessful call, a value of -1 is returned and errno is set to indicate that an error occurred. ERRORS
The timer_gettime and timer_settime functions fail under the following condition: [EINVAL] The timerid argument does not correspond to an ID returned by timer_create and not yet removed by timer_delete. Additionally, the timer_settime function can fail with this error if a value structure specified a nanosecond value less than zero or greater than or equal to 1000 million. RELATED INFORMATION
Functions: clock_gettime(3), timer_create(3) Guide to Realtime Programming delim off timer_settime(3)
All times are GMT -4. The time now is 10:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy