The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 10:47 AM
script run timer mark_nsx UNIX for Dummies Questions & Answers 2 10-08-2005 10:01 PM
Timer for VNC foweja UNIX for Advanced & Expert Users 1 07-14-2005 11:31 AM
VNC Timer foweja Shell Programming and Scripting 0 07-13-2005 01:25 PM
timer k_oops9 Shell Programming and Scripting 3 11-08-2004 11:33 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-06-2004
ulisses0205 ulisses0205 is offline
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
  #2 (permalink)  
Old 04-06-2004
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,119
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 (permalink)  
Old 04-06-2004
ulisses0205 ulisses0205 is offline
Registered User
  
 

Join Date: Apr 2004
Location: Brasil
Posts: 5
I just did It 'cause I need it immediatly
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0