Skip to content

Latest commit

 

History

History
123 lines (72 loc) · 2.68 KB

File metadata and controls

123 lines (72 loc) · 2.68 KB

DateTime

The datetime component renders the GPS date or time. It is fully controllable, using a format string to control which parts of the date to render.

Dates

<component type="datetime" format="%Y-%m-%d"/>

03-datetime-0.png

<component type="datetime" format="%d/%m/%Y"/>

03-datetime-1.png

<component type="datetime" format="%m/%d/%Y"/>

03-datetime-2.png

Times

<component type="datetime" format="%H:%M:%S" />

03-datetime-3.png

Showing fractional seconds, shows microseconds

<component type="datetime" format="%H:%M:%S.%f" />

03-datetime-4.png

Truncating fractional seconds to show only 10ths or 100ths of a second

<component type="datetime" format="%H:%M:%S.%f" truncate="5" />

03-datetime-5.png

<component type="datetime" format="%H:%M:%S.%f" truncate="4" />

03-datetime-6.png

Performance

Because rendering text is quite slow, text is cached, and the reused, rather than re-rendering it all the time. For text that changes a lot, this will be inefficient, and will eventually cause some memory problems. For this reason, its better to split up things that change a lot (times...) from things that don't change much (dates...)

If you experience memory issues, use the cache directive, explained below.

Combination of Dates and Times

It may be better to combine a text and datetime component rather than rendering everything together.

<component type="datetime" format="Date: %d/%m/%Y Time: %H:%M:%S" cache="false" />

03-datetime-7.png

<composite>
        <component x="0" y="0" type="text">Date</component>
        <component x="50" y="0" type="datetime" format="%Y/%m/%d"/>
        <component x="0" y="20" type="text">Time</component>
        <component x="50" y="20" type="datetime" format="%H:%M:%S.%f" truncate="5" cache="false" />
    </composite>

03-datetime-8.png

Sizes

Text size can be controlled with with size

<component type="datetime" format="%Y-%m-%d" size="32" />

03-datetime-9.png

Colours

Text colour and transparency is set with the rgb attribute. rgb is either 3 or 4 values for the (r,g,b) or (r,g,b,a) values for the text.

<component type="datetime" format="%Y-%m-%d" rgb="255,255,0,128" />

03-datetime-10.png