Browse Source

Glibc check for set time of System

AGP
Evgeny Gagua 4 years ago
parent
commit
ef2a5525ce
  1. 11
      lib/App/mojo/mojoKernel.cpp

11
lib/App/mojo/mojoKernel.cpp

@ -242,12 +242,23 @@ void mojoKernel::m_fThreadProc( void ){
case CMD_KRNL_SYNC_TIME:{ case CMD_KRNL_SYNC_TIME:{
uint32_t uts = atoi( tCMD->PARAM ); uint32_t uts = atoi( tCMD->PARAM );
if( uts ){ if( uts ){
#if ( __GLIBC__ < 3 ) && ( __GLIBC_MINOR__ < 31 )
time_t ts = (time_t)uts; time_t ts = (time_t)uts;
if( stime( &ts ) == 0 ){ if( stime( &ts ) == 0 ){
// Restert Server; // Restert Server;
m_bThreadStatus = TH_ENDED; m_bThreadStatus = TH_ENDED;
setExitCause( EXIT_CODE_KERNEL_CLEAR ); setExitCause( EXIT_CODE_KERNEL_CLEAR );
}; };
#else
timespec ts;
ts.tv_sec = (time_t)uts;
ts.tv_nsec = 0;
if( clock_settime( CLOCK_REALTIME, &ts ) == 0 ){
// Restert Server;
m_bThreadStatus = TH_ENDED;
setExitCause( EXIT_CODE_KERNEL_CLEAR );
};
#endif
}; };
break; break;
}; };

Loading…
Cancel
Save