X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0	tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o-
Date: Wed, 15 Jun 2011 13:48:05 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: localtime
Message-ID: <20110615174805.GC23078@ednor.casa.cgf.cx>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <4DF8CF3D.40104@gmail.com> <4DF8EA79.2060404@gmail.com> <20110615173847.GB23078@ednor.casa.cgf.cx> <4DF8EF9F.4090906@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <4DF8EF9F.4090906@gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Wed, Jun 15, 2011 at 01:45:03PM -0400, Tod wrote:
>On 06/15/2011 1:38 PM, Christopher Faylor wrote:
>> On Wed, Jun 15, 2011 at 01:23:05PM -0400, Tod wrote:
>>> On 06/15/2011 11:26 AM, Tod wrote:
>>>> Hi,
>>>>
>>>> Has anything change in regards to the C localtime function since 2007?
>>>> I've got a program with a function that uses it to present the date and
>>>> time that I just changed. The time isn't appearing only the date.
>>>>
>>>> No errors, no dumps, just no time. Most bizarre.
>>>>
>>>>
>>>> TIA - Tod
>>>
>>>
>>> Incidentally, here's how I'm valuing the time.  Worked with the 2007
>>> version of cygwin1.dll (not that I'm blaming cygwin):
>>>
>>> char * getTime(char *tout)
>>>     {
>>>      time_t      now;
>>>      struct      tm tim;
>>>
>>>      now = time(NULL);
>>>      tim = *(localtime(&now));
>>>      strftime(tout,strlen(tout),"%m/%d/%Y:%H:%M:%S",&tim);
>>>
>>>      return(tout);
>>>     }
>>>
>>> tout is a 128 byte character array.
>>
>> If that's really what you're using then strlen(tout) seems obviously
>> wrong.  It should be 128.
>
>Won't strlen(tout) resolve to 128?

No.  It resolves to the length of the string, whatever that happens to
be.  If it was "abc", then strlen would == 3.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

