The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Timer aekaramg20 Shell Programming and Scripting 6 08-21-2008 06:47 AM
script run timer mark_nsx UNIX for Dummies Questions & Answers 2 10-08-2005 06:01 PM
Timer for VNC foweja UNIX for Advanced & Expert Users 1 07-14-2005 07:31 AM
VNC Timer foweja Shell Programming and Scripting 0 07-13-2005 09:25 AM
timer k_oops9 Shell Programming and Scripting 3 11-08-2004 08:33 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-06-2004
Registered User
 

Join Date: Apr 2004
Location: Brasil
Posts: 5
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
Reply With Quote
Forum Sponsor
  #2  
Old 04-06-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,616
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.
Reply With Quote
  #3  
Old 04-06-2004
Registered User
 

Join Date: Apr 2004
Location: Brasil
Posts: 5
I just did It 'cause I need it immediatly
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0