On 11/3/05, Bronek Kozicki <brok@rubikon.pl> wrote:
with assertion failed in msvcr80d. I thought that the problem was fixed?

Oh boy.  Not this again?  I thought they were going to fix this one:

http://article.gmane.org/gmane.comp.lib.boost.testing/1303

This looks like a slightly different (though related) problem from before.  The assertion is happening in the bowels of strftime:

     msvcr80d.dll!_expandtime (localeinfo_struct * plocinfo=0x0012cdcc, char specifier='Y', const tm * timeptr=0x0012d0dc, char * * string=0x0012cdf4, unsigned int * left=0x0012cddc, __lc_time_data * lc_time=0x003587c8, unsigned int alternate_form=0)  Line 783 + 0x35 bytes    C++
     msvcr80d.dll!_Strftime_l(char * string=0x00358759, unsigned int maxsize=16, const char * format=0x0012ce8e, const tm * timeptr=0x0012d0dc, void * lc_time_arg=0x003587c8, localeinfo_struct * plocinfo=0x00000000)  Line 415 + 0x28 bytes    C++
     msvcr80d.dll!_Strftime(char * string=0x00358758, unsigned int maxsize=16, const char * format=0x0012ce8c, const tm * timeptr=0x0012d0dc, void * lc_time_arg=0x003587c8)  Line 345 + 0x1b bytes    C++
     msvcp80d.dll!std::time_put <char,std::ostreambuf_iterator<char,std::char_traits<char> > >::do_put(std::ostreambuf_iterator<char,std::char_traits<char> > _Dest={...}, std::ios_base & __formal={...}, std::ios_base & __formal={...}, const tm * _Pt=0x0012d0dc, char _Specifier='Y', char _Modifier=0)  Line 489 + 0x45 bytes    C++
     msvcp80d.dll!std::time_put<char,std::ostreambuf_iterator<char,std::char_traits<char> > >::put(std::ostreambuf_iterator<char,std::char_traits<char> > _Dest={...}, std::ios_base & _Iosbase={...}, char _Fill=' ', const tm * _Pt=0x0012d0dc, const char * _Fmtfirst=0x00358709, const char * _Fmtlast=0x00358719)  Line 424 + 0x39 bytes    C++
     testlocal_time.exe!boost::date_time::date_facet<boost::gregorian::date,char,std::ostreambuf_iterator<char,std::char_traits<char> > >::do_put_tm(std::ostreambuf_iterator<char,std::char_traits<char> > next={...}, std::ios_base & a_ios={...}, char fill_char=' ', const tm & tm_value={...}, std::basic_string<char,std::char_traits<char>,std::allocator<char> > a_format="%Y-%b-%d %H:%M:%S")  Line 355 + 0xb3 bytes    C++
>    testlocal_time.exe!boost::date_time::time_facet<boost::posix_time::ptime,char,std::ostreambuf_iterator<char,std::char_traits<char> > >::put(std::ostreambuf_iterator<char,std::char_traits<char> > a_next={...}, std::ios_base & a_ios={...}, char a_fill=' ', const boost::posix_time::ptime & a_time={...})  Line 383 + 0x91 bytes    C++
     testlocal_time.exe!boost::posix_time::operator<<<char,std::char_traits<char> >(std::basic_ostream<char,std::char_traits<char> > & os={...}, const boost::posix_time::ptime & p={...})  Line 62 + 0x63 bytes    C++
     testlocal_time.exe!boost::local_time::local_date_time_base<boost::posix_time::ptime,boost::date_time::time_zone_base<boost::posix_time::ptime,char> >::to_string()  Line 287 + 0x46 bytes    C++
     testlocal_time.exe!main()  Line 111 + 0x12 bytes    C++
     testlocal_time.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes    C
     testlocal_time.exe!mainCRTStartup()  Line 403    C
     kernel32.dll!7c816d4f()    
     [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]   
     kernel32.dll!7c8399f3()    

Here's the relevant code from expandtime:

        case('Y'):              /* year w/ century */
        {
=>            _VALIDATE_RETURN( ( timeptr->tm_year >=0 ), EINVAL, FALSE)
            temp = (((timeptr->tm_year/100)+19)*100) +
                   (timeptr->tm_year%100);
            /* pass alternate_form as the no leading zeros flag */
            _store_num(temp, 4, string, left, alternate_form);
            break;
        }

timeptr    0x0012d0dc {tm_sec=0 tm_min=0 tm_hour=0 ...}    const tm *
        tm_sec    0    int
        tm_min    0    int
        tm_hour    0    int
        tm_mday    1    int
        tm_mon    0    int
        tm_year    -500    int
        tm_wday    3    int
        tm_yday    0    int
        tm_isdst    -1    int

It isn't happy with the data in the struct tm as returned by boost::posix_time::to_tm.

--
Caleb Epstein
caleb dot epstein at gmail dot com