Time

Please check the status of this specification in Launchpad before editing it. If it is Approved, contact the Assignee or another knowledgeable person before making changes.

Summary

Define and implement a Time component for inclusion in the UI Toolkit

Rationale

There are many apps that need not a Timer, but the current time at a specific resolution to keep updates to a minimum needed by the application.

Use cases

The Clock, Calendar applications. Any other application that needs to know the current time and update accordingly.

Scope

This includes:

  • Including a Time component in the UI Toolkit.

Design

I propose the addition of a following API:

C++:

enum Resolution {
    Invalid,
    Milliseconds,
    Seconds,
    Minutes,
    Hours,
    Days
};

QML:

Time {
    property int resolution: Time.Invalid
    property bool utc: false
    property string offset // defaults to current local time offset, setting to undefined resets

    readonly property int milliseconds
    readonly property int seconds
    readonly property int minutes
    readonly property int hours
    readonly property int day
    readonly property int weekday
    readonly property int week
    readonly property int month
    readonly property int year
    readonly property Date date
    readonly property bool dst
}

The implementation should make sure to only wake up when necessary - i.e. if there's only one Time object that requires a resolution of Days, there should be minimal activity between updating the days property (and higher-precision properties should remain at 0). The date property should also only be updated in accordance with the resolution property.

When there are more Time objects, the backend should be shared, set up with the lowest possible precision, but each Time object should only update its properties with the resolution requested of it.

Implementation

Unresolved issues

BoF agenda and discussion


CategorySpec CategorySpec

UIToolkit/Specs/Time (last edited 2013-06-13 12:24:55 by saviq)