Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: printf and time_t
Date: Sun, 01 Mar 2026 23:21:05 -0800
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <864imyg0im.fsf@linuxsc.com>
References: <10jfol6$2u6r8$1@news.xmission.com> <10jfs23$2liif$1@dont-email.me> <10jgc2t$2rp4s$2@nntp.eternal-september.org> <86o6n5pocw.fsf@linuxsc.com> <10jm6se$r6nl$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Mon, 02 Mar 2026 07:21:10 +0000 (UTC)
Injection-Info: dont-email.me; posting-host="879346d16fc7c1cd3f18baf5c462c148"; logging-data="970912"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uTpMmVPuK3PlsxfgLZ4TnRpiO83VH66M="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:3TFleYtdoAUffBuSaOtiM8a8mNI= sha1:WAiBl9M2wlqHhD3Ub1n7rLtDI+0=
Xref: csiph.com comp.lang.c:396721
"James Russell Kuyper Jr." writes:
> On 2026-01-07 08:02, Tim Rentsch wrote:
>
>> James Kuyper writes:
>>
>>> On 2026-01-05 03:17, Andrey Tarasevich wrote:
>
> ...
>
>>>> You can't. As far as the language is concerned, `time_t` is intended
>>>> to be an opaque type. It has to be a real type, ...
>>>
>>> In C99, it was only required to be an arithmetic type. I pointed out
>>> that this would permit it to be, for example, double _Imaginary. [...]
>>
>> It's hard to imagine how time_t being an imaginary type could
>> provide the semantics described in the C standard for time_t.
>
> You'll need to elaborate on that. time_t is an opaque type which
> could, on one implementation, have been long double. Another
> implementation could have stored the same value as the imaginary
> component of _Imaginary long double, and could work with that value
> the same way as the first one. [...]
The C standard doesn't say that time_t is an opaque type. What it
does say (in the C99 standard) is that it is an arithmetic type
capable of representing times, and that the range and precision of
those times are implementation defined. The idea that time_t is an
opaque type doesn't mesh with that description, nor does it mesh
with historical usage that predates even the earliest work on the
original (ANSI) C standard. Even if we don't know the range and
precision, we expect to be able to operate on time values with
standard arithmetic operators, but that doesn't work for complex
or imaginary values because of the rules for relational operators.
Besides all of that, _Imaginary types don't satisify the condition
for time_t to be an arithmetic type. Annex G says the imaginary
types are floating types, but in C99 Annex G is informative, not
normative.