3 ms·
I agree with the sentiment, but there are a lot of more complicated scenarios in real-world applications. For example, most calendar apps need the concept of a
by mbrubeck 17y ago
I agree with the sentiment, but there are a lot of more complicated scenarios in real-world applications. For example, most calendar apps need the concept of a "floating timezone":
I may have one item on my schedule called "nap time" with a time of 15:00 (no time zone). I want my computer to tell me to take a nap at 15:00 local time, no matter where in the world I am today. But I have another item on my schedule called "conference call with CEO" with a time of 13:30 PDT. I want that call to happen at a specific absolute time (not local time).
- jerf 17y ago'For example, most calendar apps need the concept of a "floating timezone":' Ok... but that's a timezone, too, at least from the point of view I'm talking about. It's not an ill-defined 11:00am, it's a specific 11:00am. The root problem is specifications that match more than one uniquely-defined time.
- arohner 17y agoJoda time has this concept, it calls it a partial http://joda-time.sourceforge.net/key_partial.html http://joda-time.sourceforge.net/key_partial.html . A partial is a datetime without a time zone, so it only partially specifies a time. You can combine a partial with a timezone to get an instant, a fully specified date time. It's also interesting to note that some operations cannot be performed with partials. For example, you can't add an instant and a partial (because that would be buggy). In order to add them, you have to first convert the partial to an instant (by specifying a timezone). In the parent's example, nap time would be a partial of 15:00, and your calendar app would notify about nap time by specifying the current timezone of the computer.