Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <973C11FE0E3ED41183B200508BC7774C0C95EB84@csexchange.crystal.cirrus.com> From: "Yang, Huaichen" To: "'cygwin AT cygwin DOT com'" Subject: Is it a problem in function localtime(...)? Date: Wed, 16 Apr 2003 13:15:42 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" The localtime(...) is running OK in cygwin. However, if I run the following program out of cygwin (didn't start cygwin): When I commented the line "loctime = localtime (&curtime)", there is no problem. All environment variables can be shown up correctly; If I uncommented this line, the first two environment variables were replaced with binary characters, that crached down the program. The problem seems that if some Cygwin environment variable doesn't exist, the localtime() will destroy the environment variable list, instead of returning a NULL. #include #include int main (int argc, char *argv[], char *envp[]) { time_t curtime; struct tm *loctime; int i; /* Get the current time. */ curtime = time (NULL); /* Convert it to local time representation. */ loctime = localtime (&curtime); for (i = 0; envp[i] != 0; ++i) { printf("-->env[%d]=\"%s\"\n", i, envp[i]); } return 0; } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/