Replacement for KDateTime

Dāvis Mosāns davispuh at gmail.com
Mon Aug 3 14:29:41 BST 2015


2015-08-03 15:26 GMT+03:00 David Jarvie <djarvie at kde.org>:
> On Monday 03 Aug 2015 12:59:59 you wrote:
>
>> 2015-08-02 21:32 GMT+03:00 David Jarvie <djarvie at kde.org>:
>
>> >
>
>> > Date-only KDateTime instances are not only used for Event start/end
>
>> > timestamps. In KAlarm they are also used among other things for alarm
>> > snooze
>
>> > times (independently of whether the event is date-only or not). So usage
>> > of
>
>> > the date-only attribute is *not* restricted to Events (even if that is
>> > all
>
>> > it is used for in kcalcore).
>
>> >
>
>>
>
>> Sorry for injecting myself, but IMO there's no such thing as Date-only and
>
>> what you need is something like QDateTimeRange (just made up) where you
>> would
>
>> have start QDateTime, end QDateTime and it could represent any
>> Event/Interval.
>
>> Like whole day, part of day or even multiple days. And could also check
>> whether
>
>> some QDateTime is inside this range.
>
>
>
> Date-only extends the current QDateTime concept to allow it to represent a
> single date (which is intrinsically a time range) or a single date-time,
> without requiring any extra date-time information to be stored - only a
> boolean flag is required to indicate whether the time component should be
> ignored.
>
>
>
> A generalised time range on the other hand requires storing distinct start
> and end times, and cannot (except for special cases) be represented by a
> single date or date-time.
>

That sounds like kind of a hack... trying to save few bytes for very
minimal use case.
As soon as you'll need to represent something outside of that you'll
need a proper range.
Besides can implement range with QDateTime + qint64




More information about the kde-core-devel mailing list