[Development] std::chrono getters in our API
Thiago Macieira
thiago.macieira at intel.com
Sat Jun 11 01:27:18 CEST 2016
On sexta-feira, 10 de junho de 2016 16:12:10 PDT Matthew Woehlke wrote:
> On 2016-06-10 13:53, Thiago Macieira wrote:
> > I've added a set of std::chrono API to QTimer[1] and QDeadlineTimer[2] and
> > we're hitting a snag on what to name the getters. The setters are fine
> > because>
> > they're just overloads:
> > timer.setInterval(3); // Qt; milliseconds
> > timer.setInterval(3ms);
> > deadline.setRemainingTime(3600000); // milliseconds
> > deadline.setRemainingTime(1h);
> > deadline.setDeadline(QDeadlineTimer::current().deadline() + 3600000);
> > deadline.setDeadline(std::chrono::steady_clock::now() + 1h);
> >
> > The problem are the getters: what do we call them?
>
> Qt6-only option... return a QTimeInterval or some such with (implicit)
> conversion operators.
QTimeInterval helps for std::chrono::duration, but not for the other use in
QDeadlineTimer: deadline() returns the equivalent of a
std::chrono::time_point.
QDeadlineTimer *is* the equivalent of a std::chrono::time_point.
> I expect there are issues with that, but feels worth mentioning at least
> for the sake of discussion.
So, you're suggesting not doing anything now, leave std::chrono support out in
Qt 5, and do it only for Qt 6?
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
More information about the Development
mailing list