Standard class for time *period*?

Dennis Lee Bieber wlfraed at ix.netcom.com
Tue Mar 28 08:05:40 EDT 2023


On Tue, 28 Mar 2023 08:14:55 +0200, "Loris Bennett"
<loris.bennett at fu-berlin.de> declaimed the following:

>
>No, it doesn't.  I already know about timedelta.  I must have explained
>the issue badly, because everyone seems to be fixating on the
>formatting, which is not a problem and is incidental to what I am really
>interested in, namely:
>
>1. Is there a standard class for a 'period', i.e. length of time
>   specified by a start point and an end point?  The start and end
>   points could obviously be datetimes and the difference a timedelta,
>   but the period '2022-03-01 00:00 to 2022-03-02 00:00' would be
>   different to '2023-03-01 00:00 to 2023-03-02 00:00' even if the
>   *duration* of both periods is the same.
>
>2. If such a standard class doesn't exist, why does it not exist?
>

	So far, you seem to be the only person who has ever asked for a single
entity incorporating an EPOCH (datetime.datetime) + a DURATION
(datetime.timedelta). You are asking for two durations of the same length
to be considered different if they were computed from different "zero"
references (epochs). I don't think I've ever encountered an application
that doesn't use a single epoch (possibly per run) with all internal
computations using a timedelta FROM THAT EPOCH! (The exception may have
been computing star atlases during the conversion from B1900 to J2000
reference frames.)


More information about the Python-list mailing list