Ignore:
Timestamp:
05/30/13 18:08:47 (9 years ago)
Author:
ymipsl
Message:

Bug fix : Solve problem in splitting date
Enhancement : Add file attribute split_freq_format to manage the suffix added in splitted file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/file.cpp

    r391 r431  
    207207      if (! split_freq.isEmpty()) 
    208208      { 
    209         if (*lastSplit+splitFreq < currentDate) 
     209        if (currentDate > *lastSplit+splitFreq) 
    210210        { 
    211           *lastSplit=currentDate-outputFreq ; 
    212          
     211          *lastSplit=*lastSplit+splitFreq ;     
    213212          std::vector<CField*>::iterator it, end = this->enabledFields.end(); 
    214213          for (it = this->enabledFields.begin() ;it != end; it++)  (*it)->resetNStep() ; 
     
    231230         oss << filename; 
    232231         if (!name_suffix.isEmpty()) oss << name_suffix.getValue(); 
    233          if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStryyyymmdd()<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStryyyymmdd(); 
     232//         if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStryyyymmdd()<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStryyyymmdd(); 
     233//         if (!split_freq.isEmpty()) oss<<"_"<<lastSplit->getStr("%y_%mo_%d")<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStr("%y_%mo_%d"); 
     234         if (!split_freq.isEmpty()) 
     235         { 
     236           string splitFormat ; 
     237           if (split_freq_format.isEmpty()) 
     238           { 
     239             if (splitFreq.second!=0) splitFormat="%y%mo%d%h%mi%s"; 
     240             else if (splitFreq.minute!=0) splitFormat="%y%mo%d%h%mi"; 
     241             else if (splitFreq.hour!=0) splitFormat="%y%mo%d%h"; 
     242             else if (splitFreq.day!=0) splitFormat="%y%mo%d"; 
     243             else if (splitFreq.month!=0) splitFormat="%y%mo"; 
     244             else splitFormat="%y"; 
     245           } 
     246           else splitFormat=split_freq_format ; 
     247           oss<<"_"<<lastSplit->getStr(splitFormat)<<"-"<< (*lastSplit+(splitFreq-1*Second)).getStr(splitFormat); 
     248         } 
     249            
    234250         bool multifile=true ; 
    235251         if (!type.isEmpty()) 
Note: See TracChangeset for help on using the changeset viewer.