generated from Jaysyn/ModuleTemplate
Initial commit
Initial commit
This commit is contained in:
68
_module/nss/opw_timesync.nss
Normal file
68
_module/nss/opw_timesync.nss
Normal file
@@ -0,0 +1,68 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Olander's Time Sync
|
||||
// opw_timesync
|
||||
// By Don Anderson
|
||||
// dandersonru@msn.com
|
||||
//
|
||||
// This is for Module Cycle Executions That Require Accuracy
|
||||
// This is Executed When the Module Loads - opw_mod_onload
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void TimeSync(object oMod)
|
||||
{
|
||||
//Cycle Time
|
||||
int nCycle = 30;
|
||||
float f30MC = IntToFloat(nCycle);
|
||||
|
||||
//:****************************************************************************/
|
||||
//: MODULES HAVING TIMING ISSUES WITH THE CLOCK (MODULE STRESS)
|
||||
|
||||
int nCLOCKSYNC = GetLocalInt(oMod,"CLOCKSYNC");
|
||||
if(nCLOCKSYNC == 1)
|
||||
{
|
||||
//Current Time Info
|
||||
int nCurHour = GetTimeHour();
|
||||
int nCurMin = GetTimeMinute();
|
||||
int nCurSec = GetTimeSecond();
|
||||
int nCurMS = GetTimeMillisecond();
|
||||
|
||||
//Clock Sync
|
||||
SetTime(nCurHour,nCurMin,nCurSec,nCurMS);
|
||||
}
|
||||
|
||||
//: MODULES HAVING TIMING ISSUES WITH THE CLOCK (MODULE STRESS)
|
||||
//:****************************************************************************/
|
||||
|
||||
//:****************************************************************************/
|
||||
//: MODULE TIMED UDE
|
||||
|
||||
//DB Update
|
||||
SignalEvent(oMod, EventUserDefined(202));
|
||||
|
||||
//Local Clock
|
||||
SignalEvent(oMod, EventUserDefined(205));
|
||||
|
||||
//College Clock
|
||||
SignalEvent(oMod, EventUserDefined(204));
|
||||
|
||||
//Realistic Weather
|
||||
SignalEvent(oMod, EventUserDefined(206));
|
||||
|
||||
//: MODULE TIMED UDE
|
||||
//:****************************************************************************/
|
||||
|
||||
|
||||
DelayCommand(f30MC,TimeSync(oMod));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
object oMod = GetModule();
|
||||
if(GetLocalInt(oMod,"TIMESYNCRUNNING") == 1) return;
|
||||
|
||||
//Start the Time Sync Loop
|
||||
SetLocalInt(oMod,"TIMESYNCRUNNING",1);
|
||||
DelayCommand(120.0,TimeSync(oMod));
|
||||
}
|
||||
Reference in New Issue
Block a user