From: Georg Krichel on 29 Nov 2006 02:36 This code (unmanaged C++, Visual Studio 2005) for( int d = 1; d < 8; ++d ) { cout << endl; tm t; t.tm_year = 70; t.tm_mon = 0; t.tm_mday = d; t.tm_hour = 0; t.tm_min = 0; t.tm_sec = 0; t.tm_isdst = -1; cout << t.tm_year + 1900 << '-' << t.tm_mon + 1 << '-' << t.tm_mday << endl; mktime( &t ); // == _mktime64( &t ); const char* bug = ( t.tm_mday != d ) ? " <-- BUG?" : ""; cout << t.tm_year + 1900 << '-' << t.tm_mon + 1 << '-' << t.tm_mday << bug << endl; } produces this output: 1970-1-1 1970-1-1 1970-1-2 1970-1-1 <-- BUG? 1970-1-3 1970-1-2 <-- BUG? 1970-1-4 1970-1-3 <-- BUG? 1970-1-5 1970-1-5 1970-1-6 1970-1-6 1970-1-7 1970-1-7 Question: Is date adjustment correct for dates Jan 2, 1970 to Jan 4, 1970? I don't think so. Greetings from Cologne (Germany) Georg Krichel
From: David Lowndes on 1 Dec 2006 04:40 >This code (unmanaged C++, Visual Studio 2005) > >for( int d = 1; d < 8; ++d ) >{ > cout << endl; > tm t; > t.tm_year = 70; > t.tm_mon = 0; > t.tm_mday = d; > t.tm_hour = 0; > t.tm_min = 0; > t.tm_sec = 0; > t.tm_isdst = -1; > cout << t.tm_year + 1900 << '-' << t.tm_mon + 1 << '-' << t.tm_mday > << endl; > mktime( &t ); // == _mktime64( &t ); > const char* bug = ( t.tm_mday != d ) ? " <-- BUG?" : ""; > cout << t.tm_year + 1900 << '-' << t.tm_mon + 1 << '-' << t.tm_mday > << bug << endl; >} > >produces this output: >... >1970-1-2 >1970-1-1 <-- BUG? Georg, I can't repro this. Are you using any particular compiler settings? Dave
From: Tom Widmer [VC++ MVP] on 1 Dec 2006 05:17 Georg Krichel wrote: > This code (unmanaged C++, Visual Studio 2005) [snip] > 1970-1-2 > 1970-1-1 <-- BUG? > > 1970-1-3 > 1970-1-2 <-- BUG? > > 1970-1-4 > 1970-1-3 <-- BUG? > > 1970-1-5 > 1970-1-5 > > 1970-1-6 > 1970-1-6 > > 1970-1-7 > 1970-1-7 > > Question: > Is date adjustment correct for dates Jan 2, 1970 to Jan 4, 1970? It certainly seems wrong. > I don't think so. > > Greetings from Cologne (Germany) I managed to reproduce the problem by setting my time zone to match yours (Berlin). Tom
From: David Lowndes on 1 Dec 2006 07:28 >I managed to reproduce the problem by setting my time zone to match >yours (Berlin). Curious. I've just set mine to Berlin too - still no repro for me. I have VS2005 SP1 beta installed though! Dave
|
Pages: 1 Prev: error LNK2001 Next: Problem in subclassing of ProgMan->SHELLDLL_DefView->SysListView32 |