예제 #1
0
파일: context.cpp 프로젝트: gatgui/fbpg
void Context::clear() {
  TimerStart("clear");
#ifdef _CTXH
  ObjectMap::Entry *entry = mVars.first();
  while (entry) {
    if (entry->second) {
      if (entry->second->refCount() <= 0) {
        std::ostringstream oss;
        oss << "*** Object in context has already been deleted";
        throw std::runtime_error(oss.str());
      }
      entry->second->decRef();
    }
    entry = mVars.next();
  }
#else
  ObjectMap::iterator it = mVars.begin();
  while (it != mVars.end()) {
    if (it->second) {
      if (it->second->refCount() <= 0) {
        std::ostringstream oss;
        oss << "*** Object \"" << it->first << "\" in context has already been deleted";
        throw std::runtime_error(oss.str());
      }
      it->second->decRef();
    }
    ++it;
  }
#endif
  mVars.clear();
  TimerEnd("clear");
}
예제 #2
0
파일: pap.c 프로젝트: vstakhov/mpd
void
PapStart(Link l, int which)
{
	PapInfo pap = &l->lcp.auth.pap;

	switch (which) {
	case AUTH_PEER_TO_SELF:	/* Just wait for peer's request */
		break;

	case AUTH_SELF_TO_PEER:

		/* Initialize retry counter and timer */
		pap->next_id = 1;
		pap->retry = AUTH_RETRIES;

		TimerInit(&pap->timer, "PapTimer",
		    l->conf.retry_timeout * SECONDS, PapTimeout, l);
		TimerStart(&pap->timer);

		/* Send first request */
		PapSendRequest(l);
		break;

	default:
		assert(0);
	}
}
예제 #3
0
/*!
 * \brief   MCPS-Confirm event function
 *
 * \param   [IN] mcpsConfirm - Pointer to the confirm structure,
 *               containing confirm attributes.
 */
static void McpsConfirm( McpsConfirm_t *mcpsConfirm )
{
    if( mcpsConfirm->Status == LORAMAC_EVENT_INFO_STATUS_OK )
    {
        switch( mcpsConfirm->McpsRequest )
        {
            case MCPS_UNCONFIRMED:
            {
                // Check Datarate
                // Check TxPower
                break;
            }
            case MCPS_CONFIRMED:
            {
                // Check Datarate
                // Check TxPower
                // Check AckReceived
                // Check NbTrials
                break;
            }
            case MCPS_PROPRIETARY:
            {
                break;
            }
            default:
                break;
        }

        // Switch LED 1 ON
        GpioWrite( &Led1, 1 );
        TimerStart( &Led1Timer );
    }
    NextTx = true;
}
예제 #4
0
/**********************************************************************
* TimerTest
* Description: Basic test of timer functionality
* Notes:  Uses 1 timer slot - cannot be unregistered,  only use for
* 	testing and debugging.
***********************************************************************/
void TimerTest( void)
{
	uint8_t t1 = 0;

	t1 = RegisterTimer();	//register the timer
	TimerStart(t1, 1000L);   //starts t1, 1 second interval
	LED0_ON;					//turn on the LED
	while(TimerIsOn(t1));	//wait until timer has finished


	//SAME THING FOR LED OFF
	TimerStart(t1, 1000L);   //starts t1, 1 second interval
	LED0_OFF;
	while(TimerIsOn(t1));

}
예제 #5
0
static void
RicochetMenuHandleEvent (EventPtr event)
{
    switch (event->data.menu.itemID) {
    case menuRicochetRestart:
        RicochetRestart ();
        break;
    case menuRicochetNext:
        RicochetNext ();
        break;
    case menuRicochetNew:
        RicochetNext ();
        break;

    case menuTimerStart:
        TimerStart ();
        break;
    case menuTimerStop:
        TimerStop ();
        break;

    case menuHelpControls:
        Help(controlForm);
        break;
    case menuHelpRules:
        Rules ();
        break;
    case menuHelpGetInfo:
        Help(infoForm);
        break;

    }
}
예제 #6
0
파일: main.c 프로젝트: busmaster/homebus
/*-----------------------------------------------------------------------------
*  main
*/
int main(void) {

   uint8_t ret;
   int   sioHdl;

   /* set clock prescaler to 2 (set clock to 7.3928 MHz) */
   CLKPR = 1 << CLKPCE;
   CLKPR = 1;

   /* get module address from EEPROM */
   sMyAddr = eeprom_read_byte((const uint8_t *)MODUL_ADDRESS);
   GetClientListFromEeprom();
    
   PortInit();
   TimerInit();
   ButtonInit();
   PwmInit();
   ApplicationInit();

   SioInit();
   SioRandSeed(sMyAddr);

   /* sio for bus interface */
   sioHdl = SioOpen("USART1", eSioBaud9600, eSioDataBits8, eSioParityNo,
                    eSioStopBits1, eSioModeHalfDuplex);

   SioSetIdleFunc(sioHdl, IdleSio1);
   SioSetTransceiverPowerDownFunc(sioHdl, BusTransceiverPowerDown);
   BusTransceiverPowerDown(true);

   BusInit(sioHdl);
   spBusMsg = BusMsgBufGet();

   /* warten for full operation voltage */
   while (!POWER_GOOD);

   /* enable ints before RestorePwm() */
   ENABLE_INT;
   TimerStart();
   RestorePwm();

   /* ext int for power fail: INT0 low level sensitive */
   EICRA &= ~((1 << ISC01) | (1 << ISC00));
   EIMSK |= (1 << INT0);

   ApplicationStart();
   
   /* Hauptschleife */
   while (1) {
      Idle();
      ret = BusCheck();
      ProcessBus(ret);
      CheckButton();
      PwmCheck();
      ApplicationCheck();
      CheckEvent();
   }
   return 0;
}
예제 #7
0
/********************************************************************
Function name:    TimerUpdate
Input parameters:
    
Return:
    
Function:
    
********************************************************************/
void TimerUpdate(UINT32 TimerCnt)
{
    TimerStop(T0);
    TimerValSet(T0, TimerCnt);
    TimerCpltFlagClr(T0);
    TimerStart(T0);
    TimerDoneChk(T0);
}
예제 #8
0
static void
TimerToggle (void)
{
    if (game.timer_running)
        TimerStop ();
    else
        TimerStart ();
}
예제 #9
0
    virtual void Init(RobotInfo ri, NavInfo ni)
	{
        pid_trace_.Init();
		if (0 < timer_) {
			TimerStart(timer_);
		}
		local_status_ = MISSION_START;
    }
예제 #10
0
/*************************************************
  Function:		LogicInit
  Description:  
  Input:		
  Output:		
  Return:		
  Others:
*************************************************/
void LogicInit(void)
{
	HarewareInit();
	StorageInit();
    GuiInit();
	SetBeepIndex(_HW_BEEP_OK_);
    TimerStart();
    LogicSetMasterCtl(FRAME_ADDR_PC);
}
예제 #11
0
/*!
 * \brief  Function executed on ultrasonic sensor timeout event
 *  If range and temperature readings not available in reasonable time
 *  sends sensor data with range and temperature in error 
 */
static void OnUltrasonicTimeout ( void ) {

    pc.printf("OnUltrasonicTimeout - Sensor FAULT\r\n");
    SensorState = FAULT;
    NextTx = true;
    TimerSetValue( &TxNextPacketTimer, 100 ); // Schedule immediate transmission
    TimerStart( &TxNextPacketTimer );

}
예제 #12
0
/*!
 * task to blink led rtos between 1 seconds.
 */
void task_led_rtos( task_param_t param )
{
    TimerInit(&Led1Timer, "Led1Timer", 250, OnLed1TimerEvent, false);
    TimerInit(&Led2Timer, "Led2Timer", 250, OnLed2TimerEvent, false);
    TimerInit(&Led3Timer, "Led3Timer", 250, OnLed3TimerEvent, false);

    // Switch LED 1 ON
    GpioWrite(&Led1, 0);
    TimerStart(&Led1Timer);

    while (1) {
        if ( Led1TimerEvent == true ) {
            Led1TimerEvent = false;

            // Switch LED 1 OFF
            GpioWrite(&Led1, 1);
            // Switch LED 2 ON
            GpioWrite(&Led2, 0);
            TimerStart(&Led2Timer);
        }

        if ( Led2TimerEvent == true ) {
            Led2TimerEvent = false;

            // Switch LED 2 OFF
            GpioWrite(&Led2, 1);
            // Switch LED 3 ON
            GpioWrite(&Led3, 0);
            TimerStart(&Led3Timer);
        }

        if ( Led3TimerEvent == true ) {
            Led3TimerEvent = false;

            // Switch LED 3 OFF
            GpioWrite(&Led3, 1);
            // Switch LED 1 ON
            GpioWrite(&Led1, 0);
            TimerStart(&Led1Timer);
        }
        OSA_TimeDelay(50);
    }
}
    virtual void Init(RobotInfo ri, NavInfo ni){
        pid_trace_.Init();
    	straight_.Init(ri);
		TimerStart(1000);
		speed_ = 70;
    	local_status_ = P_START;
    	dist.x = ni.pos.X;
    	dist.y = ni.pos.Y;
    	dist.xy = (dist.x * dist.x) + (dist.y * dist.y);
    }
예제 #14
0
void osTimerInterruptInitialize(void)
{
/* ************ BEGIN TARGET SPECIFIC SECTION **************/
    TimerInterval(0);
    (VPint(TDATA(0))) = gBUSCLK/100;
    TimerStart(0);

    Enable_Int(TIMER0_INT);
/* ************ END TARGET SPECIFIC SECTION **************/
}
예제 #15
0
/*****************************************************************
* init timer1
* Init timer hardware if needed here
******************************************************************/
void InitTimers(void)
{
	//SETUP ANY HARDWARE AS NEEDED

	//CHECKOUT THE TIMERS THAT WILL BE USED IN THE SYSTEM
	timer_pb = RegisterTimer();	//register the timer

	//START THE TIMERS IF THEY ARE FREE RUNNING
	TimerStart(timer_pb, TIME_PB0);	//restart the time

}
예제 #16
0
파일: pap.c 프로젝트: vstakhov/mpd
static void
PapTimeout(void *ptr)
{
	Link const l = (Link) ptr;
	PapInfo const pap = &l->lcp.auth.pap;

	if (--pap->retry > 0) {
		TimerStart(&pap->timer);
		PapSendRequest(l);
	}
}
예제 #17
0
int TestMod11A(PDOT11_MOD_ARGS pArgs)
{
    BB11A_TX_VECTOR      TxVector;
    BB11ATxContextInit(&TxVector, pArgs->SampleRate);

    if (!Dot11ARate_KbpsValid(pArgs->nBitRate))
    {
        printf("Data rate %d kbps is not supported by 802.11a mode\n", pArgs->nBitRate);
        return -1;
    }
    TxVector.ti_uiDataRate = Dot11ADataRate_Kbps2Code(pArgs->nBitRate);

    if (PreparePacket(pArgs->pcInFileName, &Mdl, &Packet, DataBuffer, SymbolBuffer, SYMBOLBUF_SIZE) < 0)
        return -1;

    TIMINGINFO  ti;
    double dTimeSum = 0.0;

    // Cache warm-up for first 2 rounds
    for (int i = 0; i < 2; i++)
    {
        BB11ATxFrameMod(&TxVector, &Packet);
    }

    // Measure modulation speed for many rounds
    TimerStart(&ti);
    for (int i = 0; i < RUN_TIMES; i++)
    {
        BB11ATxFrameMod(&TxVector, &Packet);
    }
    TimerStop(&ti);
    dTimeSum = TimerRead(&ti) * 1000;

    printf("Signal data rate:    %d kbps\n", Dot11ADataRate_Code2Kbps(TxVector.ti_uiDataRate));
    printf("Signal packet size:  %d\n", Packet.PacketSize);
    printf("Signal encoded size: %d\n", Packet.Reserved3);
    printf("Time cost average:   %.3f us \n", dTimeSum / RUN_TIMES);

    FILE* pOut = NULL;
#pragma warning (push)
#pragma warning (disable:4996)
    pOut = fopen(pArgs->pcOutFileName, "w+b");
#pragma warning (pop)
    if (!pOut)
    {
        printf("Cannot create output file.\n");
        return -1;
    }

    fwrite(Packet.pReserved, Packet.Reserved3, 1, pOut);
    fclose(pOut);

    return 0;
}
    virtual void Init(RobotInfo ri, NavInfo ni)
	{
        pid_trace_.Init();
		if (0 < timer_) {
			TimerStart(timer_);
		}
    	local_status_ = P_RUN_START;
    	dist.x = ni.pos.X;
    	dist.y = ni.pos.Y;
    	dist.xy = (dist.x * dist.x) + (dist.y * dist.y);
    }
    virtual void Init(RobotInfo ri, NavInfo ni){
        tec_s_.Init(ri);
		tec_p_.Init();
		tec_r_.Init();
        speed_ = 40;
		local_status_ = P_REACHING;
        s_time_ = clock.now();
		tecType_ = TEC_P;
    	SeesawAng = ni.pos.Ang;
    	TimerStart(15000);
        set_current_position(pos, ni);
        edge_dir = Technic::LEFT;
    }
예제 #20
0
void DexVirtualTracker::Initialize( void ) {

	TimerStart( &oscillate_timer );

	manipulandumPosition[X] = 150.0;
	manipulandumPosition[Y] = 125.0;
	manipulandumPosition[Z] = 25.0;

	samplePeriod = 0.5;

	nAcqFrames = 0;

}
예제 #21
0
static Boolean
RicochetKeyHandleEvent (EventPtr event)
{
    Boolean handled = true;

    switch (event->data.keyDown.chr) {
    case 'r':
    case 'R':
        RicochetRestart();
        break;
    case 'n':
    case 'N':
        RicochetNext ();
        break;
    case 'g':
    case 'G':
        RicochetNew ();
        break;
    case 'u':
    case 'U':
        RicochetUndo ();
        break;

    case 't':
    case 'T':
        TimerStart ();
        break;
    case 's':
    case 'S':
        TimerStop ();
        break;

    case 'c':
    case 'C':
        Help (controlForm);
        break;
    case 'l':
    case 'L':
        Rules ();
        break;
    case 'i':
    case 'I':
        Help (infoForm);
        break;

    default:
        handled = false;
        break;
    }
    return handled;
}
예제 #22
0
파일: subscribe.c 프로젝트: 01org/opa-ff
// Queue a Trap timer callback to issue a subscribe or unsubscribe
// must be called with SubscribedTrapsListLock held
static void
QueueTrapTimer(TRAP_REFERENCE *pTrapReference, uint32 timeout_ms)
{
	_DBG_ENTER_LVL(_DBG_LVL_FUNC_TRACE, QueueTrapTimer);

	if (SubscribeInitialized != 0)
	{
		// restart timer if running
		TimerStop(&pTrapReference->Timer);
		TimerStart(&pTrapReference->Timer, timeout_ms);
	}

	_DBG_LEAVE_LVL( _DBG_LVL_FUNC_TRACE );
}
예제 #23
0
void benchmark(VglImage* img_in, VglImage* img_out, float* mask, int* mask_size, int nSteps, ConvoluteType type, char* operator_name,char* prefix_path, float(*MMD_KERNEL)(float color, float mask_value, float value, ConvoluteType type, float gamma), float gamma = 0.2f)
{
  const float gama = 0.2f;
  TimerStart();
  CONVOLUTE(img_in, img_out, mask, mask_size, type, MMD_KERNEL, gama);
  if (img_in->ndim == 2)
    printf("First call to        %s %dx%d:                %s\n",operator_name,mask_size[0],mask_size[1], getTimeElapsedInSeconds());
  else if (img_in->ndim == 3)
    printf("First call to        %s %dx%dx%d:                %s\n", operator_name, mask_size[0], mask_size[1], mask_size[2], getTimeElapsedInSeconds());
  //Total time spent on n operations FuzzyErode 3x3
  int p = 0;
  TimerStart();
  while (p < nSteps)
  {
    p++;
    CONVOLUTE(img_in, img_out, mask, mask_size, type, MMD_KERNEL, gama);
    //vglClCopy(out,img);
  }
  if (img_in->ndim == 2)
    printf("Time spent on %8d %s %dx%d:                %s\n", nSteps, operator_name, mask_size[0], mask_size[1], getTimeElapsedInSeconds());
  else if (img_in->ndim == 3)
    printf("Time spent on %8d %s %dx%d%d:                %s\n", nSteps, operator_name, mask_size[0], mask_size[1], mask_size[2], getTimeElapsedInSeconds());

  char* outFilename = (char*)malloc(400);
  if (img_in->ndim == 2)
  {
    sprintf(outFilename, "%s/%s_%dx%d.%s", prefix_path, operator_name, mask_size[0], mask_size[1], "tif");
    cvSaveImage(outFilename, img_out->ipl);
  }
  else if (img_in->ndim == 3)
  {
    sprintf(outFilename, "%s/%s_%dx%dx%d.%s", prefix_path, operator_name, mask_size[0], mask_size[1], mask_size[2], "dcm");
    vglDcmtkSaveDicom(outFilename, img_out, 0);
    //vglGdcmSaveDicom(outFilename, img_out, 0);
  }
  
}
예제 #24
0
static void OnRadioTxDone( void )
{
    TimerTime_t curTime = TimerGetCurrentTime();

    LOG_TRACE("Transmitted successfully (%u ms).", (uint32_t)(curTime * portTICK_PERIOD_MS));

// Update Band Time OFF
    Bands[Channels[pLoRaDevice->currChannelIndex].Band].LastTxDoneTime = curTime;
    if ( pLoRaDevice->dbgFlags.Bits.dutyCycleCtrlOff == 0 ) {
        Bands[Channels[pLoRaDevice->currChannelIndex].Band].TimeOff = TxTimeOnAir
                * Bands[Channels[pLoRaDevice->currChannelIndex].Band].DCycle - TxTimeOnAir;
    } else {
        Bands[Channels[pLoRaDevice->currChannelIndex].Band].TimeOff = 0;
    }
// Update Agregated Time OFF
    AggregatedLastTxDoneTime = curTime;
    AggregatedTimeOff = AggregatedTimeOff + (TxTimeOnAir * AggregatedDCycle - TxTimeOnAir);

    if ( phyFlags.Bits.TxType == LORAPHY_TXTYPE_ADVERTISING ) {
        /* Open advertising beacon reception window */

    } else if ( phyFlags.Bits.TxType == LORAPHY_TXTYPE_REGULAR
            && pLoRaDevice->dbgFlags.Bits.rxWindowsDisabled != 1 ) {
        TimerSetValue(&RxWindow1Timer, pLoRaDevice->rxWindow1Delay);
        TimerStart(&RxWindow1Timer);
        TimerSetValue(&RxWindow2Timer, pLoRaDevice->rxWindow2Delay);
        TimerStart(&RxWindow2Timer);
    } else {
        phyFlags.Bits.TxDone = 1;
    }

    /* Uplink message repetition is only valid for unconfirmed messages */
    if ( pLoRaDevice->ctrlFlags.Bits.ackPending == 0 ) {
        pLoRaDevice->nbRepCounter++;
    }
}
예제 #25
0
void MainWindow::AddNewRow()
{
    Variable *  var = new Variable(client,this);
    VariableDialog dlg(var,Map,this);
    if (dlg.exec() == QDialog::Accepted)
    {
        variables.insert(var->GetName(),var);
        var->connectNewSample(this,SLOT(VariableModified()));
        RefreshTable();

        if (ui->actionConnect->isChecked())
            emit TimerStart();
    }
    else
    {
        var->deleteLater();
    }
}
예제 #26
0
//*****************************************************************************
//
//! \biref The main example function
//!
//! \return  none
//
//*****************************************************************************
void OneSecondClock(void)
{
    SysCtlHClockSet(SYSCTL_XTAL_12MHZ | SYSCTL_OSC_MAIN);
    //
    // Set the timer clock
    //
    SysCtlPeripheralClockSourceSet(SYSCTL_PERIPH_TMR0_S_EXT12M);

    //
    // Enable tiemr0
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TMR0);

    //
    // Clear the flag first
    //
    TimerIntClear(TIMER0_BASE, TIMER_INT_MATCH);
    while(TimerIntStatus(TIMER0_BASE, TIMER_INT_MATCH));

    //
    // Config as One shot mode
    //
    TimerInitConfig(TIMER0_BASE, TIMER_MODE_PERIODIC, 1000);
    TimerPrescaleSet(TIMER0_BASE, 91);
    TimerMatchSet(TIMER0_BASE, 0x1ffff);
    TimerIntEnable(TIMER0_BASE, TIMER_INT_MATCH);

    //
    // Start the timer
    //
    TimerStart(TIMER0_BASE);

    //
    // One shot mode test.
    //
    while(1)
    {
        //
        // wait until the timer data register reach equel to compare register
        //
        while(!TimerIntStatus(TIMER0_BASE, TIMER_INT_MATCH));
        TimerIntClear(TIMER0_BASE, TIMER_INT_MATCH);
    }
}
void main(void)
{ 

    unsigned long Status = 0;

    /********************** Configure System clock *************************/
    SysCtlClockSet(100000000, SYSCTL_OSC_INT | SYSCTL_XTAL_12_MHZ);
    SysCtlDelay(TICK_SLOW);

    // Enable LED PORT
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

    // Configure LED(PC3) pin into output mode.
    xGPIOSPinTypeGPIOOutput(PC3);

    // Configure Timer Capture pin(PB26)
    GPIOPinFunCfg(GPIOB_BASE, GPIO_PIN_26,  GPIO_PB26_TIMCCP0);

    TimerCounterCfg(TIMER0_BASE, TIMER_CFG_CNT_CAP0_BOTH);
    TimerReset(TIMER0_BASE);
    TimerStart(TIMER0_BASE);

    while (1)
    {

        if( (TimerValueGet(TIMER0_BASE) % 10) == 0)
        {
            if(Status)
            {
                // Turn on LED
                Status = 0;
                GPIOPinSet(GPIOC_BASE, GPIO_PIN_3);
            }
            else
            {
                // Turn off LED
                Status = 1;
                GPIOPinClr(GPIOC_BASE, GPIO_PIN_3);
            }
        }
    }

    while(1);
}
예제 #28
0
int main( void ) {
	
	SystemInit();
	SystemCoreClockUpdate();
	TimerInit();
	
	TimerStart(); {
		printf( "test_max_alc=%i \n",                   test_max_alc() );

		printf( "test_alc_free_max=%i \n",              test_alc_free_max() );
		printf( "test_static_alc_free=%i \n",           test_static_alc_free() );
		printf( "test_static_alc_free_violation=%i \n", test_static_alc_free_violation() );
		printf( "test_rndm_alc_free=%i \n",             test_rndm_alc_free() );
		printf( "test_max_alc_1_byte=%i \n",            test_max_alc_1_byte() );
	} TimerStop();
	
	printf( "The elappsed time is %d ms\n", current_elapsed_time() );
	
	while(1);
}
예제 #29
0
int
main(int argc, char *argv[]) {
  char   **av, fname[STRLEN] ;
  int    ac, nargs, i ;
  char   *in_fname, *out_fname ;
  int          msec, minutes, seconds ;
  struct timeb start ;

  /* rkt: check for and handle version tag */
  nargs = handle_version_option (argc, argv, "$Id: main_template.c,v 1.5 2011/03/02 00:04:40 nicks Exp $", "$Name:  $");
  if (nargs && argc - nargs == 1)
    exit (0);
  argc -= nargs;

  Progname = argv[0] ;
  ErrorInit(NULL, NULL, NULL) ;
  DiagInit(NULL, NULL, NULL) ;

  TimerStart(&start) ;

  ac = argc ;
  av = argv ;
  for ( ; argc > 1 && ISOPTION(*argv[1]) ; argc--, argv++) {
    nargs = get_option(argc, argv) ;
    argc -= nargs ;
    argv += nargs ;
  }

  if (argc < 3)
    usage_exit(1) ;


  msec = TimerStop(&start) ;
  seconds = nint((float)msec/1000.0f) ;
  minutes = seconds / 60 ;
  seconds = seconds % 60 ;
  fprintf(stderr, "inverse operator application took %d minutes"
          " and %d seconds.\n", minutes, seconds) ;
  exit(0) ;
  return(0) ;
}
예제 #30
0
/*-------------------------------------------
  "Start" button
---------------------------------------------*/
void OnOK(HWND hDlg)
{
	PTIMERSTRUCT pitem;
	char section[20];
	int i, nOldTimer;
	
	/* save settings */
	GetTimerFromDlg(hDlg, get_listitem(m_pTimer, m_nCurrent));
	
	nOldTimer = GetMyRegLong(NULL, "TimerNum", 0);
	
	pitem = m_pTimer;
	for(i = 0; pitem; i++)
	{
		wsprintf(section, "Timer%d", i + 1);
		SetMyRegStr(section, "Name", pitem->name);
		SetMyRegLong(section, "Minute", pitem->minute);
		SetMyRegLong(section, "Second", pitem->second);
		SetMyRegStr(section, "File", pitem->fname);
		SetMyRegLong(section, "Repeat", pitem->bRepeat);
		SetMyRegLong(section, "Blink", pitem->bBlink);
		SetMyRegLong(section, "Disp", pitem->bDisp);
		SetMyRegLong(section, "DispType", pitem->nDispType);
		SetMyRegLong(section, "UserStr", pitem->nUserStr);
		
		pitem = pitem->next;
	}
	
	SetMyRegLong(NULL, "TimerNum", i);
	
	for(; i < nOldTimer; i++)
	{
		wsprintf(section, "Timer%d", i + 1);
		DelMyRegKey(section);
	}
	
	/* start a timer */
	TimerStart(get_listitem(m_pTimer, m_nCurrent));
	
	DestroyWindow(hDlg);
}