---------------------------------------------------------------------------
| 496 | } |
| 497 | //--------------------------------------------------------------------------- |
| 498 | void TStorageFileList::CheckRotate(void) |
| 499 | { |
| 500 | try |
| 501 | { |
| 502 | TDateTime t = Now(); |
| 503 | unsigned short year, month, day, hour, min, sec, msec; |
| 504 | t.DecodeDate(&year, &month, &day); |
| 505 | t.DecodeTime(&hour, &min, &sec, &msec); |
| 506 | |
| 507 | TStorageFile * p; |
| 508 | for(int i=0; i<Count; i++) |
| 509 | { |
| 510 | p = Get(i); |
| 511 | |
| 512 | if( p->rotation_type != 2 ) // by date |
| 513 | continue; |
| 514 | if( p->last_date == 0 ) |
| 515 | { |
| 516 | p->last_date = (int)t; // today |
| 517 | if( hour < p->rotation_hour ) |
| 518 | p->last_date--; // perform rotation today |
| 519 | continue; |
| 520 | } |
| 521 | if( (int)t > p->last_date ) |
| 522 | { |
| 523 | // now is next (or another) day |
| 524 | |
| 525 | switch( p->rotation_moment ) |
| 526 | { |
| 527 | case 0: // Day |
| 528 | break; |
| 529 | case 1: // Week |
| 530 | if( t.DayOfWeek() != 2 ) // not Monday |
| 531 | { |
| 532 | p->last_date = (int)t; |
| 533 | continue; |
| 534 | } |
| 535 | break; |
| 536 | case 2: // Month |
| 537 | if( day != 1 ) // not first day of monyh |
| 538 | { |
| 539 | p->last_date = (int)t; |
| 540 | continue; |
| 541 | } |
| 542 | break; |
| 543 | case 3: // Year |
| 544 | if( month != 1 && day != 1 ) // not first day of year |
| 545 | { |
| 546 | p->last_date = (int)t; |
| 547 | continue; |
| 548 | } |
| 549 | break; |
| 550 | default: |
| 551 | continue; |
| 552 | } |
| 553 | |
| 554 | if( hour >= p->rotation_hour ) |
| 555 | { |