Date And Time Handling Overview

Functions that manipulates date and time values.

Architectural relationships

The system maintains two clocks:

  • a secure clock that can only be set by kernel code or by an application that has TCB capability. This is a clock that can be used by secure DRM applications.

  • a non-secure clock that can be set by applications that require no specific capability. This is the clock that is used for user-visible time displays.

The non-secure clock is implemented in terms of an offset from the secure clock.

Both the secure time and the non-secure time can be set using the System Static Functions API, and specifically:

Non-secure time

System locale settings, which affect date and time formatting, are set through TLocale in the Locale Settings API.

Description

The API has three key concepts: point in time, time utilities, and time interval.

Point in time

The point in time is a 64-bit integer that represents time as the number of microseconds since midnight on 1st January 0 AD, using a nominal Gregorian calendar. It can be set to the current system time, can have arithmetic and comparison operations performed on it, and can be converted into a string formatted according to the locale and other options.

The main point in time interface is provided by TTime. A support class TDateTime is provided that allows time values to be get and set in an easy-to-use format, such as year, month, day, rather than as an integer.

The time value in a TTime object can be set using either the secure time or the non-secure time.

Time utilities

The time utilities provides miscellaneous time functions, for such things as checking for leap years.

The time utilities interface is provided by Time.

Time interval

The time interval represents a period between two points in time. Time intervals can be added or subtracted, either to or from each other or to or from points in time.

The time interval interface is provided by a base class TTimeIntervalBase and by a family of derived classes for second, minute, hour, etc. intervals. A class outside this hierarchy, TTimeIntervalMicroSeconds, is provided for efficiency reasons (it alone stores its value as a 64-bit number).

Related information