Ignore:
Timestamp:
11/27/15 11:03:05 (8 years ago)
Author:
rlacroix
Message:

Fortran interface: Add functions to convert a string to a date or a duration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/interface/c/icduration.cpp

    r794 r801  
    1313    if (!string_copy(dur.toString(), str, str_size)) 
    1414      ERROR("void cxios_duration_convert_to_string(cxios_duration dur_c, char* str, int str_size)", << "Input string is too short"); 
     15  } 
     16 
     17  cxios_duration cxios_duration_convert_from_string(const char* str, int str_size) 
     18  { 
     19    std::string dur_str; 
     20    xios::CDuration dur; 
     21 
     22    if (cstr2string(str, str_size, dur_str)) 
     23      dur = xios::CDuration::FromString(dur_str); 
     24 
     25    return { dur.year, dur.month, dur.day, dur.hour, dur.minute, dur.second, dur.timestep }; 
    1526  } 
    1627 
Note: See TracChangeset for help on using the changeset viewer.