Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <3961E621.D8E47659@home.com> Date: Tue, 04 Jul 2000 09:26:57 -0400 From: Ravi Chari Organization: @Home Network X-Mailer: Mozilla 4.73 [en]C-AtHome0405 (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: cygwin Subject: Wierd mktime and localtime behavior Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I recently updated my gcc. mktime doesn't seem to update all the fields in struct tm and localtime just seems completely broken. ~/draft1 522 > gcc -g -o tt timetest.c ~/draft1 523 > tt after mktime: yy = 100 mm = 6 dd = 4 wd = -1 after localtime: yy = 69 mm = 11 dd = 31 wd = 3 ~/draft1 524 > gcc -v Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/specs gcc version 2.95.2 19991024 (release-2) At least in Unix, a call to mktime fixes all the the fields in tm. I first thought this was g++ problem, but this seems to be there in gcc as well. I have seen frequent references to localtime problems, but they seem to involve TimeZone problems and appear to have been fixed. Am I not set up properly or am I doing something wrong? Appreciate any help. Ravi Here is the example code: ------------------- // timetest.c #include #include #include int main(int argc, char **argv){ struct tm _tm, *_tm1; time_t jul; _tm.tm_year = 100; _tm.tm_mday = 4; _tm.tm_mon = 6; _tm.tm_wday = -1; jul = mktime(&_tm); printf("after mktime: yy = %d mm = %d dd = %d wd = %d\n",_tm.tm_year, _tm.tm_mon, _tm.tm_mday, _tm.tm_wday); _tm1 = localtime(&jul); printf("after localtime: yy = %d mm = %d dd = %d wd = %d\n",_tm1->tm_year, _tm1->tm_mon, _tm1->tm_mday, _tm1->tm_wday); return 0; } -------------- -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com