X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0	tests=AWL,BAYES_00,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4DF901FC.8080901@cs.umass.edu>
Date: Wed, 15 Jun 2011 15:03:24 -0400
From: Eliot Moss <moss@cs.umass.edu>
Reply-To: moss@cs.umass.edu
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: localtime
References: <4DF8CF3D.40104@gmail.com> <4DF8EA79.2060404@gmail.com> <20110615173847.GB23078@ednor.casa.cgf.cx> <4DF8EF9F.4090906@gmail.com> <20110615174805.GC23078@ednor.casa.cgf.cx> <4DF8F426.7040705@gmail.com>
In-Reply-To: <4DF8F426.7040705@gmail.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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 6/15/2011 2:04 PM, Tod wrote:
> On 06/15/2011 1:48 PM, Christopher Faylor wrote:
>> 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.

strlen is based on the current contents of the array ... it stops
at the first null. So it's certainly possible that you will truncate
output.  sizeof would indeed be more appropriate, since you care
about how much space you have available, not where the next null
byte is in memory ...

Best -- Eliot Moss

--
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

