Changeset 4603


Ignore:
Timestamp:
Mar 10, 2010 2:05:55 PM (5 years ago)
Author:
tboeckel
Message:
  • YAM_AB.c, YAM_CO.c: added the hidden integer option "BirthdayCheckTime" to define the time at which the cyclic birthday check should be performed. This value defaults to 1000 which represents the time 10:00. Valid values range from 0000 to 2359 with value mod 100 <= 59.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r4601 r4603  
    882010-03-10 Thore Böckelmann <tboeckel@gmx.de> 
    99 
     10  * YAM_AB.c, YAM_CO.c: added the hidden integer option "BirthdayCheckTime" to 
     11    define the time at which the cyclic birthday check should be performed. This 
     12    value defaults to 1000 which represents the time 10:00. Valid values range 
     13    from 0000 to 2359 with value mod 100 <= 59. 
    1014  * YAM_AB.c, YAM.c, Timer.c: birthdays are now checked on a regular basis. This 
    1115    means that YAM will automatically check for pending birthdays at 00:01 each 
  • trunk/src/YAM_AB.c

    r4601 r4603  
    498498{ 
    499499  struct TimeVal nowTV; 
    500   struct TimeVal tomorrowTV; 
    501   struct DateStamp tomorrowDS; 
     500  struct TimeVal nextTV; 
     501  struct DateStamp nextDS; 
    502502 
    503503  ENTER(); 
     
    544544  } 
    545545 
    546   // retrigger the birthday check for the next day at 00:01 
    547   DateStamp(&tomorrowDS); 
    548   tomorrowDS.ds_Days++; 
    549   tomorrowDS.ds_Minute = 1; 
    550   tomorrowDS.ds_Tick = 0; 
     546  // retrigger the birthday check for the configured check time 
     547  DateStamp(&nextDS); 
     548  nextDS.ds_Minute = (C->BirthdayCheckTime / 100) * 60 + (C->BirthdayCheckTime % 100); 
     549  nextDS.ds_Tick = 0; 
     550 
     551  DateStamp2TimeVal(&nextDS, &nextTV, TZC_NONE); 
     552 
     553  GetSysTime(TIMEVAL(&nowTV)); 
     554  if(CmpTime(TIMEVAL(&nowTV), TIMEVAL(&nextTV)) < 0) 
     555  { 
     556    // if the check time is already over for today we schedule the next check 
     557    // for tomorrow 
     558    nextDS.ds_Days++; 
     559    DateStamp2TimeVal(&nextDS, &nextTV, TZC_NONE); 
     560  } 
     561 
     562  // calculate the remaining time until the next check 
     563  SubTime(TIMEVAL(&nextTV), TIMEVAL(&nowTV)); 
    551564 
    552565  #if defined(DEBUG) 
     
    554567  char dateString[64]; 
    555568 
    556   DateStamp2String(dateString, sizeof(dateString), &tomorrowDS, DSS_DATETIME, TZC_NONE); 
     569  DateStamp2String(dateString, sizeof(dateString), &nextDS, DSS_DATETIME, TZC_NONE); 
    557570  D(DBF_TIMER, "next birthday check @ %s", dateString); 
    558571  } 
    559572  #endif 
    560  
    561   // calculate the remaining time until tomorrow 00:01 
    562   DateStamp2TimeVal(&tomorrowDS, &tomorrowTV, TZC_NONE); 
    563   GetSysTime(TIMEVAL(&nowTV)); 
    564   SubTime(TIMEVAL(&tomorrowTV), TIMEVAL(&nowTV)); 
    565  
    566   RestartTimer(TIMER_CHECKBIRTHDAYS, tomorrowTV.Seconds, tomorrowTV.Microseconds); 
     573  RestartTimer(TIMER_CHECKBIRTHDAYS, nextTV.Seconds, nextTV.Microseconds); 
    567574 
    568575  LEAVE(); 
  • trunk/src/YAM_CO.c

    r4592 r4603  
    10761076    co->SocketOptions.LowDelay    = FALSE; 
    10771077    co->SocketTimeout = 30; // 30s socket timeout per default 
     1078    co->BirthdayCheckTime = 1000; // check birthdays at 10:00 
    10781079    co->TRBufferSize = 8192; // 8K buffer per default 
    10791080    co->EmbeddedMailDelay = 200; // 200ms delay per default 
     
    17901791  } 
    17911792 
     1793  // check for valid birthday check times 
     1794  if(co->BirthdayCheckTime < 0 || co->BirthdayCheckTime > 2359 || (co->BirthdayCheckTime % 100) > 59) 
     1795  { 
     1796    co->BirthdayCheckTime = 1000; 
     1797    saveAtEnd = TRUE; 
     1798  } 
     1799 
    17921800  if(update == TRUE && G->CO != NULL) 
    17931801  { 
  • trunk/src/YAM_COs.c

    r4592 r4603  
    614614    fprintf(fh, "AutoClip         = %s\n", Bool2Txt(co->AutoClip)); 
    615615    fprintf(fh, "ShowFilterStats  = %s\n", Bool2Txt(co->ShowFilterStats)); 
     616    fprintf(fh, "BirthdayCheckTime= %04d\n", co->BirthdayCheckTime); 
    616617 
    617618    // analyze if we really didn't meet an error during the 
     
    13291330          { 
    13301331            co->LetterPart = atoi(value); 
    1331             if(co->LetterPart == 0) 
     1332            if(co->LetterPart <= 0) 
    13321333              co->LetterPart = 1; 
    13331334          } 
     
    14381439          else if(stricmp(buf, "AutoClip") == 0)          co->AutoClip = Txt2Bool(value); 
    14391440          else if(stricmp(buf, "ShowFilterStats") == 0)   co->ShowFilterStats = Txt2Bool(value); 
     1441          else if(stricmp(buf, "BirthdayCheckTime") == 0) co->BirthdayCheckTime = atoi(value); 
    14401442          else 
    14411443            W(DBF_CONFIG, "unknown config option: '%s' = '%s'", buf, value); 
  • trunk/src/YAM_config.h

    r4592 r4603  
    462462  int   SpamFlushTrainingDataThreshold; 
    463463  int   SocketTimeout; 
     464  int   BirthdayCheckTime; 
    464465 
    465466  enum  PrintMethod        PrintMethod; 
Note: See TracChangeset for help on using the changeset viewer.