Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: What about my last date functions? there are some error? Date: Tue, 08 Nov 2016 12:05:29 -0800 Organization: None to speak of Lines: 31 Message-ID: References: <87d1i69r5w.fsf@bsb.me.uk> <871sym9dpv.fsf@bsb.me.uk> <87bmxp978j.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="e43f89eff67778d2e2548cd041b513fe"; logging-data="31840"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wqfHqndtCzNLuoNtx4OiC" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:GDRMErjAg5RlKyh5NlJQorcXa5s= sha1:S7MjNQUcwAjsIEHZC1Amg8xo7NA= Xref: csiph.com comp.lang.c:96123 Richard Heathfield writes: > On 08/11/16 18:06, Ben Bacarisse wrote: > >> I suspect your preferred code will not go that far >> out on exactly the same systems that have a limited range of time_t >> values. > > You're right, of course. Nevertheless, it's still a win over time_t. > Let's assume time_t uses a long int under the bonnet, and let's further > assume that it encodes seconds (a not uncommon implementation, as we > both know). On a 32-bit-long-int system, that gives us a range of 49710 > days, which is 136+ years. Julian dates, on the same system, can cover > well over 11,000,000 years. > > I have no particular need for /millions/ of years, at least not yet, but > I find the ability to stretch back through the second millennium (and > even into the first) to be useful from time to time. Desktop Unix-like systems these days tend to make time_t a 64-bit signed integer. On the other hand, 32-bit systems still exist. They can still be updated to use a 64-bit time_t, and I expect that's what will happen between now and 2038, but so far I haven't heard of a system with 32-bit long int and 64-bit time_t. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"