Hi Tim, hey all On 22.06.26 22:31, Tim Düsterhus wrote:
HiOn 6/22/26 17:34, Andreas Heigl wrote:I just think we do not need a separate "Duration" and later a "Time" class when they both - in essence - hold the same information.The Internals mailing list is not the correct location to debate philosophical questions. Humans consider `Duration`s and `Time`s to be different concepts. The difference between “meeting is (in/at) 10:00” is the difference between `Duration` and `Time`. If you conflate those, you end up being late. Similarly if I call `sleep(new Time(0, 10, 0))`, I'm expecting the process to sleep until 10 past whatever midnight comes next, not for 10 minutes.
I don't see this as a philosophical question but a question of Naming.To take your example: A meeting is never at 10:00. But at 10:00 on date X at location Y. The 10:00 part is merely one part of a meeting-time.
*If* you want philosophical questions (and yes, I believe the internals mailinglist is also the place to tackle these - as uncomfortable as they might be) then I would argue that the "Duration" you have in mind is actually not a duration but merely a ValueObject for SI-Seconds with a nanosecond resolution. After all a duration can also be "5 years". But that is explicitly excluded. Why? After all the second was in 1956 defined as 1/31,556,925.9747th of a year.
So from a philosophical point of view: Why should a *duration* only be definable in units that can (more or less relaibly) be converted into seconds?
But `sleep(new Seconds(12, 123456789))` or `sleep(Seconds::fromHours(12,34,45,123456789))` sounds like exactly what one expects.
That this `Seconds` class can then be reused later in an improved DateTime library is only a sidenote.
The idea that `Time` is midnight-based is but a western european assumption based on the gregorian calendaring system. As long as the reference-point isn't defined, a `Time` is just a collection of hours, minutes and seconds. Similar to a Money object that is just a collection of numbers and units that is in itself totally value-less as long as you don't add a currency. And in both cases the number of units that make up the next level can be different depending on the reference-point.
*That* is for me a philosophical question. Anyhow. It's not a hill I'll die upon. It's just my 0.02€ Cheers Andreas
Best regards Tim Düsterhus
--
,,,
(o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl |
| mailto:[email protected] N 50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org |
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas |
+---------------------------------------------------------------------+
| GPG-Key: https://hei.gl/keyandreasheiglorg |
+---------------------------------------------------------------------+
OpenPGP_signature.asc
Description: OpenPGP digital signature
