Changeset 549 for XIOS/trunk/src/interface/c/iccalendar.cpp
- Timestamp:
- 01/26/15 14:39:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/interface/c/iccalendar.cpp
r545 r549 1 1 #include "xmlioserver.hpp" 2 2 3 #include "icdate.hpp" 3 4 #include "exception.hpp" 4 5 #include "timer.hpp" … … 8 9 extern "C" 9 10 { 10 void cxios_create_calendar()11 {12 CTimer::get("XIOS").resume();13 xios::CContext* context = CContext::getCurrent();14 if (context->hasClient)15 context->solveCalendar();16 CTimer::get("XIOS").suspend();17 }18 19 11 void cxios_update_calendar(int step) 20 12 { … … 26 18 CTimer::get("XIOS").suspend(); 27 19 } 20 21 void cxios_get_current_date(cxios_date* current_date_c) 22 { 23 CTimer::get("XIOS").resume(); 24 const xios::CContext* context = CContext::getCurrent(); 25 const boost::shared_ptr<xios::CCalendar> cal = context->getCalendar(); 26 if (!cal) 27 ERROR("void cxios_get_current_date(cxios_date* current_date_c)", 28 << "Impossible to get the current date: no calendar was defined."); 29 const CDate& currentDate = cal->getCurrentDate(); 30 current_date_c->year = currentDate.getYear(); 31 current_date_c->month = currentDate.getMonth(); 32 current_date_c->day = currentDate.getDay(); 33 current_date_c->hour = currentDate.getHour(); 34 current_date_c->minute = currentDate.getMinute(); 35 current_date_c->second = currentDate.getSecond(); 36 CTimer::get("XIOS").suspend(); 37 } 38 39 int cxios_get_year_length_in_seconds(int year) 40 { 41 CTimer::get("XIOS").resume(); 42 const boost::shared_ptr<xios::CCalendar> cal = CContext::getCurrent()->getCalendar(); 43 if (!cal) 44 ERROR("int cxios_get_year_length_in_seconds(int year)", 45 << "Impossible to get the year length: no calendar was defined."); 46 int length = cal->getYearTotalLength(CDate(*cal, year, 01, 01)); 47 CTimer::get("XIOS").suspend(); 48 49 return length; 50 } 51 52 int cxios_get_day_length_in_seconds() 53 { 54 CTimer::get("XIOS").resume(); 55 const boost::shared_ptr<xios::CCalendar> cal = CContext::getCurrent()->getCalendar(); 56 if (!cal) 57 ERROR("int cxios_get_day_length_in_seconds()", 58 << "Impossible to get the day length: no calendar was defined."); 59 int length = cal->getDayLengthInSeconds(); 60 CTimer::get("XIOS").suspend(); 61 62 return length; 63 } 28 64 }
Note: See TracChangeset
for help on using the changeset viewer.