Solaris Timer Implementation


 
Thread Tools Search this Thread
Top Forums Programming Solaris Timer Implementation
# 1  
Old 04-06-2004
Solaris Timer Implementation

I've a problem with a Solaris program implementation: My code uses a
timer procedure and when i try to execute date -a XXXX or rdate, my
aplication stops. I can't use ntp and need to set the machine time.
Here is my procedure. If you know how you can help me, please, do it.
static void handlerDelay() {
siglongjmp( env, 1 );
}

int XoPortUtilDelay( unsigned int milissec ) {

int houveTemporizacao = 0;
int segundos;
int microSeg;
struct itimerval tempoSleep;
void (*handlerAnterior)();

segundos = milissec / 1000;
microSeg = ( milissec % 1000 ) * 1000;

//!!!
if( microSeg < 50000 ){
microSeg = 50000;
}
//!!!

tempoSleep.it_value.tv_sec = segundos;
tempoSleep.it_value.tv_usec = microSeg;
tempoSleep.it_interval.tv_sec = 0;
tempoSleep.it_interval.tv_usec = 0;

handlerAnterior = signal( SIGALRM, handlerDelay );

if( handlerAnterior == SIG_ERR ){
return FALHA;
}

/* The first call to sigsetjmp show the point where the next
siglongjmp will return. Return always 0 at first time. When siglongjmp
is called (no signal handler), execution return to the call point to
sigsetjmp and the returned value are the specified as second argument
in siglongjmp. */

houveTemporizacao = sigsetjmp( env, 1 );

if( !houveTemporizacao ){
if( setitimer( ITIMER_REAL, &tempoSleep, NULL ) == -1 ){
return FALHA;
}
pause();
}

signal( SIGALRM, handlerAnterior );

return SUCESSO;
}//fim XoPorUtilDelay
# 2  
Old 04-06-2004
According to our rules:
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting.

Please stop posting this thread in every forum that you can find. If you think that repeatedly breaking our rules is going to help you find an answer faster, you are very mistaken.
# 3  
Old 04-06-2004
I just did It 'cause I need it immediatly
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Timer as output

How do you set timer as output to the command line so that you get an output like Has been waiting for 5 seconds Has been waiting for 6 seconds ... Where only the number changes. (2 Replies)
Discussion started by: locoroco
2 Replies

2. Solaris

Solaris user Security implementation

Hi gurus, Need you help here: How we can implement I have edited /etc/default/login as TIMEOUT=60 But user is not Logged out after 60 sec inactivity. How we can implement this? e.g 3 bad passwords and the user is locked. And it is locked for certain period e.g 20 min. (1 Reply)
Discussion started by: Asteroid
1 Replies

3. UNIX for Dummies Questions & Answers

Timer

is there a timer function in unix without using C? for example i want to display a message after 5 seconds how do i do that? (2 Replies)
Discussion started by: khestoi
2 Replies

4. Shell Programming and Scripting

Timer

Is there a way to make a timer? E.g Please give the seconds... ... (6 Replies)
Discussion started by: aekaramg20
6 Replies

5. UNIX for Advanced & Expert Users

Timer for VNC

Hello fellows, I am new in this forum, i would appreciate your assistance. I need a timming system for my vnc desktops (Cybercafe timer stuff). Each unix user login to my server only with vnc, and i want to write a program that can generate timer tickets and have control on the time used for... (1 Reply)
Discussion started by: foweja
1 Replies

6. Shell Programming and Scripting

timer

Hi all, Wanted to a create a shell script ----------------------------------------------------------------------- 1) which when called will start a timer and wait for 48 hours. after 48 hours it will call some function(say XYZ) 2) Whenever this shell script is called (can be called... (3 Replies)
Discussion started by: k_oops9
3 Replies

7. Shell Programming and Scripting

writing a timer

Hi!, My shell script takes a quite a long time to execute.. Nothing appears on the screen during this period.. User are left guessing... whats going on???????????? Any ideas on how to create a small timer script which print a word on screen say " wait.. Program running" after every 10 seconds... (3 Replies)
Discussion started by: jyotipg
3 Replies

8. AIX

how to implement timer

anyone can help me how to implement the timer on AIX? I tried with 'setitimer' and its related functions, but it does not work correctly,the program exited each time. thanks (2 Replies)
Discussion started by: Frank2004
2 Replies

9. Post Here to Contact Site Administrators and Moderators

reply timer

Neo, can u please shorten the reply timer to like 1 min or so. It is prolly just me but i end up passing on replying to posts due to i hate waiting for my timer to reset w/ a 2.5 mins wait. (2 Replies)
Discussion started by: Optimus_P
2 Replies
Login or Register to Ask a Question