Standard class for time *period*?
Cameron Simpson
cs at cskk.id.au
Tue Mar 28 20:36:38 EDT 2023
On 28Mar2023 08:05, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> 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).
But not the only person to want one. I've got a timeseries data format
where (within a file) time slots are represented as a seconds offset,
and the file has an associated epoch starting point. Dual to that is
that a timeslot has an offset from the file start, and that is
effectively a (file-epoch, duration) notion.
I've got plenty of code using that which passes around UNIX timestamp
start/stop pairs. Various conversions happen to select the appropriate
file (this keeps the files of bounded size while supporting an unbounded
time range).
Even a UNIX timestamp has an implied epoch, and therefore kind of
represents that epoch plus the timestamp as a duration.
I'm not sure I understand Loris' other requirements though. It might be
hard to write a general thing which was also still useful.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list
mailing list