Opened 19 years ago
Closed 18 years ago
#167 closed Bugs (None)
Gregorian dates bugs
Reported by: | ysv_ | Owned by: | az_sw_dude |
---|---|---|---|
Milestone: | Component: | None | |
Version: | None | Severity: | |
Keywords: | Cc: |
Description
1. I read docs about boost::gregorian::date. It has the accessor 'greg_ymd year_month_day() const', but I can't find 'greg_ymd' type anywhere. 2. So I use date::ymd_type instead. All looks like except the following: Tools.h ========================================== #ifndef TOOLS_H #define TOOLS_H #include <boost/date_time/gregorian/gregorian.hpp> typedef boost::gregorian::date Date; typedef boost::gregorian::date_period Period; std::string DateToString(Date d); #endif ========================================== Tools.cpp ========================================== #include <sstream> #include <iomanip> #include "Tools.h" using namespace std; using namespace boost::gregorian; string DateToString(Date d) { ostringstream os; int m=d.month(); os<<setw(2)<<setfill('0')<<d.day()<<'/'<< setw(2)<<m<<'/'<<setw(4)<<d.year(); return os.str(); } ========================================== That's working perfectly! Now I slightly change code of Tools.cpp (remove 'm' variable): ========================================== #include <sstream> #include <iomanip> #include "Tools.h" using namespace std; using namespace boost::gregorian; string DateToString(Date d) { ostringstream os; os<<setw(2)<<setfill('0')<<d.day()<<'/'<< setw(2)<<d.month()<<'/'<<setw(4)<<d.year(); return os.str(); } ========================================== And my app crashes!!!
Change History (2)
comment:2 by , 18 years ago
Status: | assigned → closed |
---|
Logged In: YES user_id=579686 For issue 1, the 1.32 release has full reference documentation. As for the application crash there have been issues in some OS/compiler combinations that had regression failures with streaming of the greg_month class which is the type return by d.month(). However, MinGW now appears to pass all the regression tests related to streaming with the exception of wide character support. So I think this is likely resolved in the 1.32 release.
Note:
See TracTickets
for help on using tickets.