Changeset 431
- Timestamp:
- 05/30/13 18:08:47 (10 years ago)
- Location:
- XIOS/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/config/file_attribute.conf
r391 r431 9 9 DECLARE_ATTRIBUTE(StdString, sync_freq) 10 10 DECLARE_ATTRIBUTE(StdString, split_freq) 11 DECLARE_ATTRIBUTE(StdString, split_freq_format) 11 12 DECLARE_ATTRIBUTE(bool, enabled) 12 13 DECLARE_ENUM2(type,one_file,multiple_file) -
XIOS/trunk/src/date.cpp
r423 r431 214 214 } 215 215 216 StdString CDate::toString(void) const 216 217 string CDate::getStr(const string& str) const 218 { 219 ostringstream oss ; 220 int level; 221 222 level=0 ; 223 for(string::const_iterator it=str.begin();it!=str.end();++it) 224 { 225 if (level==0) 226 { 227 if (*it=='%') level++ ; 228 else oss<<*it ; 229 } 230 else if (level==1) 231 { 232 switch (*it) 233 { 234 case 'y' : 235 oss.width (4); oss.fill ('0') ; oss << year ; 236 level=0 ; 237 break ; 238 case 'm' : // month or minute 239 level++ ; 240 break ; 241 case 'd' : 242 oss.width (2); oss.fill ('0') ; oss << day ; 243 level=0; 244 break ; 245 case 'h' : 246 oss.width (2); oss.fill ('0') ; oss << hour ; 247 level=0; 248 break ; 249 case 's' : 250 oss.width (2); oss.fill ('0') ; oss << second ; 251 level=0 ; 252 break; 253 default : 254 oss<<'%'<<*it ; 255 level=0 ; 256 } 257 } 258 else if (level==2) 259 { 260 switch (*it) 261 { 262 case 'o' : // month 263 oss.width (2); oss.fill ('0') ; oss << month ; 264 level=0 ; 265 break ; 266 case 'i' : //minute 267 oss.width (2); oss.fill ('0') ; oss << minute ; 268 level=0 ; 269 break ; 270 default : 271 oss<<"%m"<<*it ; 272 level=0 ; 273 } 274 } 275 } 276 return oss.str(); 277 } 278 279 StdString CDate::toString(void) const 217 280 { 218 281 StdOStringStream oss; -
XIOS/trunk/src/date.hpp
r423 r431 57 57 StdString toString(void) const; 58 58 StdString getStryyyymmdd(void) const; 59 string getStr(const string& str) const; 60 59 61 60 62 public : /* static */ -
XIOS/trunk/src/node/file.cpp
r391 r431 207 207 if (! split_freq.isEmpty()) 208 208 { 209 if ( *lastSplit+splitFreq < currentDate)209 if (currentDate > *lastSplit+splitFreq) 210 210 { 211 *lastSplit=currentDate-outputFreq ; 212 211 *lastSplit=*lastSplit+splitFreq ; 213 212 std::vector<CField*>::iterator it, end = this->enabledFields.end(); 214 213 for (it = this->enabledFields.begin() ;it != end; it++) (*it)->resetNStep() ; … … 231 230 oss << filename; 232 231 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 234 250 bool multifile=true ; 235 251 if (!type.isEmpty())
Note: See TracChangeset
for help on using the changeset viewer.