id summary reporter owner description type status milestone component version severity resolution keywords cc 2801 gregorian_calendar_base: incorrectly assumes that sizeof(int)==sizeof(long) pelee@… James E. King, III "boost::date_time::gregorian_calendar_base() returns an int, but uses several local variables of type unsigned long, leading to warnings about possible loss of data when converting from unsigned long to int on 64 bit OSes that use the LP64 data model. Here is a rewrite of the function that generates no warnings when compiled with -Wshorten-64-to-32 under GCC 4.0.1 on Mac OS 10.5: {{{ template BOOST_DATE_TIME_INLINE int gregorian_calendar_base::week_number(const ymd_type& ymd) { date_int_type_ julianbegin = julian_day_number(ymd_type(ymd.year,1,1)); date_int_type_ juliantoday = julian_day_number(ymd); date_int_type_ day = (julianbegin + 3) % 7; date_int_type_ week = (juliantoday + day - julianbegin + 4)/7; if ((week >= 1) && (week <= 52)) { return static_cast(week); } if ((week == 53)) { if((day==6) ||(day == 5 && is_leap_year(ymd.year))) { return static_cast(week); //under these circumstances week == 53. } else { return 1; //monday - wednesday is in week 1 of next year } } //if the week is not in current year recalculate using the previous year as the beginning year else if (week == 0) { julianbegin = julian_day_number(ymd_type(static_cast(ymd.year-1),1,1)); juliantoday = julian_day_number(ymd); day = (julianbegin + 3) % 7; week = (juliantoday + day - julianbegin + 4)/7; return static_cast(week); } return static_cast(week); //not reachable -- well except if day == 5 and is_leap_year != true } }}} " Bugs assigned To Be Determined date_time Boost 1.38.0 Problem