Deutsch   English   Français   Italiano  
<87zfgfzoqi.fsf@nosuchdomain.example.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Wed, 16 Apr 2025 16:11:01 -0700
Organization: None to speak of
Lines: 57
Message-ID: <87zfgfzoqi.fsf@nosuchdomain.example.com>
References: <87y0wjaysg.fsf@gmail.com> <vt1a7f$i5jd$1@dont-email.me>
	<vti36r$g4nu$2@dont-email.me>
	<slrnvvqhmc.2eh69.candycanearter07@candydeb.host.invalid>
	<vtjknt$1sp26$1@dont-email.me> <vtk2f9$295ku$2@dont-email.me>
	<vtka7u$2ddeu$1@dont-email.me> <CNtLP.2611170$TBhc.2589292@fx16.iad>
	<vtm71q$78l6$3@dont-email.me>
	<87plhd0z76.fsf@nosuchdomain.example.com>
	<slrnvvvdch.3gc99.candycanearter07@candydeb.host.invalid>
	<87cydb28gu.fsf@nosuchdomain.example.com>
	<S2ULP.1346551$BrX.394554@fx12.iad> <vtp6hq$3349g$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 17 Apr 2025 01:11:04 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ce66778584175375d620efc7d3b77de7";
	logging-data="3396029"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18i2zR5/eV5wUj3hIZbDsPy"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:iZLPvOir3/2B6LtSxogDx1s2r8E=
	sha1:f5qwU2szgr8sstYR7vyeWjKP0VE=
Bytes: 3536

BGB <cr88192@gmail.com> writes:
> On 4/16/2025 3:04 PM, Scott Lurndal wrote:
>> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>>> candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
>>> writes:
[...]
>>>> Datetime is a nightmare, this is why we use a simple seconds-since-X
>>>> system.
>>>
>>> Indeed.  That makes it a slightly less unpleasant nightmare.
>> Back in the mainframe days, it was common to use julian dates
>> as they were both concise (5 BCD digits/20 bits) and sortable.
>>    YYDDD
>> If time was neeeded, it was seconds since midnight in a reference
>> timezone.
>
> One shorthand is to assume a year is 365.25 days (31557600 seconds),
> and then base everything else off this (initially ignoring things like
> leap-years, etc, just assume that the number of days per year is
> fractional).
>
> Then, say, 2629800 seconds per month, ...

So, a month is 30 days, 26 hours, and 15 minutes.  How is that useful?

> For some other calculations, one can assume an integer number of days
> (365), just that each day is 0.07% longer.
>
> For date/time calculations, one could then "guess" the date, and
> jitter it back/forth as needed until it was consistent with the
> calendar math.
>
> Estimate and subtract the year, estimate and subtract the month, then
> the day. Then if we have landed on the wrong day, adjust until it
> fits.
>
> Not really sure if there was a more standard way to do this.

Keeping track of time in a manner that's entirely consistent with
the Gregorian calendar is a solved problem.  C's standard library
has functions that will do that for you.  What is the point of
inventing a new and less accurate approximation?

[...]

> As for time since epoch:
> Microseconds (in a power-of-10 sense) are more common...

The C standard library already has "struct timespec", which represents
time with nanosecond precision.  Why invent something new with poorer
precision?

[...]

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */