Changeset 316 for XIOS/trunk/src/test


Ignore:
Timestamp:
02/20/12 17:42:29 (12 years ago)
Author:
ymipsl
Message:
  • Change date format :

dd/mm/yyyy-hh:mm:ss becomes yyyy-mm-dd hh:mm:ss

  • add boost date_time functionality

YM

Location:
XIOS/trunk/src/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/test/test.cpp

    r300 r316  
    33#include <string> 
    44 
     5#include <boost/date_time/gregorian/gregorian.hpp> 
     6#include <boost/date_time/posix_time/posix_time.hpp> 
     7 
    58using namespace std ; 
    6  
    7  
    8 class CLog : public ostream 
    9 { 
    10    public : 
    11    CLog() : ostream(NULL),level(0) {} 
    12    CLog& operator()(int l) {if (l<=level) rdbuf(cout.rdbuf()) ; else rdbuf(NULL) ; return *this;} 
    13    void setLevel(int l) {level=l; }  
    14    int level ; 
    15 //   ostringstream& getStream() { return *(ostringstream*)(this) ; } 
    16 //   ~CLog(void) { cout<<"info message "<< this->str();} 
    17 }; 
    18  
     9using namespace boost::posix_time ; 
     10using namespace boost::gregorian ; 
    1911 
    2012int main(void) 
    2113{ 
    22   CLog out ; 
    23   cout<<string("toto")<<endl ; 
    24   out<<"123"<<endl ; 
    25   out.setLevel(5) ; 
    26   out(7)<<"coucou 1"<<endl ; 
    27   out(3)<<"coucou 2"<<endl<<"i23"<<endl ; 
    28    
     14      ptime t(time_from_string("2012-02-30 15:24")) ; 
     15       
     16        
     17      std::cout << to_simple_string(t) << std::endl; 
     18 
     19  return 1 ;   
    2920} 
  • XIOS/trunk/src/test/test_cs.f90

    r313 r316  
    7777  CALL xios_set_context_attr("test",calendar_type="Gregorian")  
    7878  CALL xios_set_context_attr("test",calendar_type="Gregorian")  
    79   CALL xios_set_context_attr("test",start_date="01/01/2000 - 00:00:00") 
     79!  CALL xios_set_context_attr("test",start_date="01/01/2000 - 00:00:00") 
    8080  CALL xios_set_context_attr("test",calendar_type="Gregorian")  
    8181  CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj) 
Note: See TracChangeset for help on using the changeset viewer.