TTime Class Reference

class TTime

Stores and manipulates the date and time.

It represents a date and time as a number of microseconds since midnight, January 1st, 1 AD nominal Gregorian. BC dates are represented by negative TTime values. A TTime object may be constructed from a TInt64, a TDateTime a string literal, or by default, which initialises the time to an arbitrary value. To access human-readable time information, the TTime may be converted from a TInt64 into a TDateTime, which represents the date and time as seven numeric fields and provides functions to extract these fields. Alternatively, to display the time as text, the time may be formatted and placed into a descriptor using a variety of formatting commands and which may or may not honour the system's locale settings. The conversion between time and text may be performed the other way around, so that a descriptor can be parsed and converted into a TTime value.

In addition to setting and getting the date and time and converting between text and time, TTime provides functions to get intervals between times and standard comparison and arithmetic operators which enable time intervals to be added or subtracted to or from the time.

TInt64

TDateTime

Public Member Functions
TTime()
TTime(const TInt64 &)
TTime(const TDesC &)
TTime(const TDateTime &)
IMPORT_C TDateTimeDateTime()
IMPORT_C TIntDayNoInMonth()
IMPORT_C TDayDayNoInWeek()
IMPORT_C TIntDayNoInYear()
IMPORT_C TIntDayNoInYear(TTime)
IMPORT_C TTimeIntervalDaysDaysFrom(TTime)
IMPORT_C TIntDaysInMonth()
IMPORT_C voidFormatL(TDes &, const TDesC &)
IMPORT_C voidFormatL(TDes &, const TDesC &, const TLocale &)
IMPORT_C voidHomeTime()
IMPORT_C TIntHomeTimeSecure()
IMPORT_C TIntHoursFrom(TTime, TTimeIntervalHours &)
const TInt64 &Int64()
IMPORT_C TTimeIntervalMicroSecondsMicroSecondsFrom(TTime)
IMPORT_C TIntMinutesFrom(TTime, TTimeIntervalMinutes &)
IMPORT_C TTimeIntervalMonthsMonthsFrom(TTime)
IMPORT_C TIntParse(const TDesC &, TInt)
IMPORT_C voidRoundUpToNextMinute()
IMPORT_C TIntSecondsFrom(TTime, TTimeIntervalSeconds &)
IMPORT_C TIntSet(const TDesC &)
IMPORT_C voidUniversalTime()
IMPORT_C TIntUniversalTimeSecure()
IMPORT_C TIntWeekNoInYear()
IMPORT_C TIntWeekNoInYear(TTime)
IMPORT_C TIntWeekNoInYear(TFirstWeekRule)
IMPORT_C TIntWeekNoInYear(TTime, TFirstWeekRule)
IMPORT_C TTimeIntervalYearsYearsFrom(TTime)
TBool operator!=(TTime)
IMPORT_C TTimeoperator+(TTimeIntervalYears)
IMPORT_C TTimeoperator+(TTimeIntervalMonths)
IMPORT_C TTimeoperator+(TTimeIntervalDays)
IMPORT_C TTimeoperator+(TTimeIntervalHours)
IMPORT_C TTimeoperator+(TTimeIntervalMinutes)
IMPORT_C TTimeoperator+(TTimeIntervalSeconds)
IMPORT_C TTimeoperator+(TTimeIntervalMicroSeconds)
IMPORT_C TTimeoperator+(TTimeIntervalMicroSeconds32)
IMPORT_C TTime &operator+=(TTimeIntervalYears)
IMPORT_C TTime &operator+=(TTimeIntervalMonths)
IMPORT_C TTime &operator+=(TTimeIntervalDays)
IMPORT_C TTime &operator+=(TTimeIntervalHours)
IMPORT_C TTime &operator+=(TTimeIntervalMinutes)
IMPORT_C TTime &operator+=(TTimeIntervalSeconds)
IMPORT_C TTime &operator+=(TTimeIntervalMicroSeconds)
IMPORT_C TTime &operator+=(TTimeIntervalMicroSeconds32)
IMPORT_C TTimeoperator-(TTimeIntervalYears)
IMPORT_C TTimeoperator-(TTimeIntervalMonths)
IMPORT_C TTimeoperator-(TTimeIntervalDays)
IMPORT_C TTimeoperator-(TTimeIntervalHours)
IMPORT_C TTimeoperator-(TTimeIntervalMinutes)
IMPORT_C TTimeoperator-(TTimeIntervalSeconds)
IMPORT_C TTimeoperator-(TTimeIntervalMicroSeconds)
IMPORT_C TTimeoperator-(TTimeIntervalMicroSeconds32)
IMPORT_C TTime &operator-=(TTimeIntervalYears)
IMPORT_C TTime &operator-=(TTimeIntervalMonths)
IMPORT_C TTime &operator-=(TTimeIntervalDays)
IMPORT_C TTime &operator-=(TTimeIntervalHours)
IMPORT_C TTime &operator-=(TTimeIntervalMinutes)
IMPORT_C TTime &operator-=(TTimeIntervalSeconds)
IMPORT_C TTime &operator-=(TTimeIntervalMicroSeconds)
IMPORT_C TTime &operator-=(TTimeIntervalMicroSeconds32)
TBool operator<(TTime)
TBool operator<=(TTime)
TTime &operator=(const TInt64 &)
IMPORT_C TTime &operator=(const TDateTime &)
TBool operator==(TTime)
TBool operator>(TTime)
TBool operator>=(TTime)
Private Member Functions
TTime Convert(const TDateTime &)
Private Attributes
__DECLARE_TEST
TInt64 iTime

Constructor & Destructor Documentation

TTime()

TTime()[inline]

Default constructor.

The object is initialised to an arbitrary value.

TTime(const TInt64 &)

TTime(const TInt64 &aTime)[inline]

Constructs the object from a 64-bit microsecond value.

Parameters

const TInt64 & aTimeMicrosecond value to which to initialise the TTime object.

TTime(const TDesC &)

IMPORT_CTTime(const TDesC &aString)

Parameters

const TDesC & aString

TTime(const TDateTime &)

IMPORT_CTTime(const TDateTime &aDateTime)

Parameters

const TDateTime & aDateTime

Member Functions Documentation

Convert(const TDateTime &)

TTime Convert(const TDateTime &aDateTime)[private, static]

Parameters

const TDateTime & aDateTime

DateTime()

IMPORT_C TDateTimeDateTime()const

DayNoInMonth()

IMPORT_C TIntDayNoInMonth()const

DayNoInWeek()

IMPORT_C TDayDayNoInWeek()const

DayNoInYear()

IMPORT_C TIntDayNoInYear()const

DayNoInYear(TTime)

IMPORT_C TIntDayNoInYear(TTimeaStartDate)const

Parameters

TTime aStartDate

DaysFrom(TTime)

IMPORT_C TTimeIntervalDaysDaysFrom(TTimeaTime)const

Parameters

TTime aTime

DaysInMonth()

IMPORT_C TIntDaysInMonth()const

FormatL(TDes &, const TDesC &)

IMPORT_C voidFormatL(TDes &aDes,
const TDesC &aFormat
)const

Parameters

TDes & aDes
const TDesC & aFormat

FormatL(TDes &, const TDesC &, const TLocale &)

IMPORT_C voidFormatL(TDes &aDes,
const TDesC &aFormat,
const TLocale &aLocale
)const

Parameters

TDes & aDes
const TDesC & aFormat
const TLocale & aLocale

HomeTime()

IMPORT_C voidHomeTime()

HomeTimeSecure()

IMPORT_C TIntHomeTimeSecure()

HoursFrom(TTime, TTimeIntervalHours &)

IMPORT_C TIntHoursFrom(TTimeaTime,
TTimeIntervalHours &aInterval
)const

Parameters

TTime aTime
TTimeIntervalHours & aInterval

Int64()

const TInt64 &Int64()const [inline]

Gets the 64 bit integer representation of this TTime obect.

The 64 bit integer representation.

MicroSecondsFrom(TTime)

IMPORT_C TTimeIntervalMicroSecondsMicroSecondsFrom(TTimeaTime)const

Parameters

TTime aTime

MinutesFrom(TTime, TTimeIntervalMinutes &)

IMPORT_C TIntMinutesFrom(TTimeaTime,
TTimeIntervalMinutes &aInterval
)const

Parameters

TTime aTime
TTimeIntervalMinutes & aInterval

MonthsFrom(TTime)

IMPORT_C TTimeIntervalMonthsMonthsFrom(TTimeaTime)const

Parameters

TTime aTime

Parse(const TDesC &, TInt)

IMPORT_C TIntParse(const TDesC &aDes,
TIntaCenturyOffset = 0
)

Parameters

const TDesC & aDes
TInt aCenturyOffset = 0

RoundUpToNextMinute()

IMPORT_C voidRoundUpToNextMinute()

SecondsFrom(TTime, TTimeIntervalSeconds &)

IMPORT_C TIntSecondsFrom(TTimeaTime,
TTimeIntervalSeconds &aInterval
)const

Parameters

TTime aTime
TTimeIntervalSeconds & aInterval

Set(const TDesC &)

IMPORT_C TIntSet(const TDesC &aString)

Parameters

const TDesC & aString

UniversalTime()

IMPORT_C voidUniversalTime()

UniversalTimeSecure()

IMPORT_C TIntUniversalTimeSecure()

WeekNoInYear()

IMPORT_C TIntWeekNoInYear()const

WeekNoInYear(TTime)

IMPORT_C TIntWeekNoInYear(TTimeaStartDate)const

Parameters

TTime aStartDate

WeekNoInYear(TFirstWeekRule)

IMPORT_C TIntWeekNoInYear(TFirstWeekRuleaRule)const

Parameters

TFirstWeekRule aRule

WeekNoInYear(TTime, TFirstWeekRule)

IMPORT_C TIntWeekNoInYear(TTimeaStartDate,
TFirstWeekRuleaRule
)const

Parameters

TTime aStartDate
TFirstWeekRule aRule

YearsFrom(TTime)

IMPORT_C TTimeIntervalYearsYearsFrom(TTimeaTime)const

Parameters

TTime aTime

operator!=(TTime)

TBool operator!=(TTimeaTime)const [inline]

Tests whether two date/times are not equal.

True if the two TTimes are different. False if the same.

Parameters

TTime aTimeThe date/time to be compared with this TTime.

operator+(TTimeIntervalYears)

IMPORT_C TTimeoperator+(TTimeIntervalYearsaYear)const

Parameters

TTimeIntervalYears aYear

operator+(TTimeIntervalMonths)

IMPORT_C TTimeoperator+(TTimeIntervalMonthsaMonth)const

Parameters

TTimeIntervalMonths aMonth

operator+(TTimeIntervalDays)

IMPORT_C TTimeoperator+(TTimeIntervalDaysaDay)const

Parameters

TTimeIntervalDays aDay

operator+(TTimeIntervalHours)

IMPORT_C TTimeoperator+(TTimeIntervalHoursaHour)const

Parameters

TTimeIntervalHours aHour

operator+(TTimeIntervalMinutes)

IMPORT_C TTimeoperator+(TTimeIntervalMinutesaMinute)const

Parameters

TTimeIntervalMinutes aMinute

operator+(TTimeIntervalSeconds)

IMPORT_C TTimeoperator+(TTimeIntervalSecondsaSecond)const

Parameters

TTimeIntervalSeconds aSecond

operator+(TTimeIntervalMicroSeconds)

IMPORT_C TTimeoperator+(TTimeIntervalMicroSecondsaMicroSecond)const

Parameters

TTimeIntervalMicroSeconds aMicroSecond

operator+(TTimeIntervalMicroSeconds32)

IMPORT_C TTimeoperator+(TTimeIntervalMicroSeconds32aMicroSecond)const

Parameters

TTimeIntervalMicroSeconds32 aMicroSecond

operator+=(TTimeIntervalYears)

IMPORT_C TTime &operator+=(TTimeIntervalYearsaYear)

Parameters

TTimeIntervalYears aYear

operator+=(TTimeIntervalMonths)

IMPORT_C TTime &operator+=(TTimeIntervalMonthsaMonth)

Parameters

TTimeIntervalMonths aMonth

operator+=(TTimeIntervalDays)

IMPORT_C TTime &operator+=(TTimeIntervalDaysaDay)

Parameters

TTimeIntervalDays aDay

operator+=(TTimeIntervalHours)

IMPORT_C TTime &operator+=(TTimeIntervalHoursaHour)

Parameters

TTimeIntervalHours aHour

operator+=(TTimeIntervalMinutes)

IMPORT_C TTime &operator+=(TTimeIntervalMinutesaMinute)

Parameters

TTimeIntervalMinutes aMinute

operator+=(TTimeIntervalSeconds)

IMPORT_C TTime &operator+=(TTimeIntervalSecondsaSecond)

Parameters

TTimeIntervalSeconds aSecond

operator+=(TTimeIntervalMicroSeconds)

IMPORT_C TTime &operator+=(TTimeIntervalMicroSecondsaMicroSecond)

Parameters

TTimeIntervalMicroSeconds aMicroSecond

operator+=(TTimeIntervalMicroSeconds32)

IMPORT_C TTime &operator+=(TTimeIntervalMicroSeconds32aMicroSecond)

Parameters

TTimeIntervalMicroSeconds32 aMicroSecond

operator-(TTimeIntervalYears)

IMPORT_C TTimeoperator-(TTimeIntervalYearsaYear)const

Parameters

TTimeIntervalYears aYear

operator-(TTimeIntervalMonths)

IMPORT_C TTimeoperator-(TTimeIntervalMonthsaMonth)const

Parameters

TTimeIntervalMonths aMonth

operator-(TTimeIntervalDays)

IMPORT_C TTimeoperator-(TTimeIntervalDaysaDay)const

Parameters

TTimeIntervalDays aDay

operator-(TTimeIntervalHours)

IMPORT_C TTimeoperator-(TTimeIntervalHoursaHour)const

Parameters

TTimeIntervalHours aHour

operator-(TTimeIntervalMinutes)

IMPORT_C TTimeoperator-(TTimeIntervalMinutesaMinute)const

Parameters

TTimeIntervalMinutes aMinute

operator-(TTimeIntervalSeconds)

IMPORT_C TTimeoperator-(TTimeIntervalSecondsaSecond)const

Parameters

TTimeIntervalSeconds aSecond

operator-(TTimeIntervalMicroSeconds)

IMPORT_C TTimeoperator-(TTimeIntervalMicroSecondsaMicroSecond)const

Parameters

TTimeIntervalMicroSeconds aMicroSecond

operator-(TTimeIntervalMicroSeconds32)

IMPORT_C TTimeoperator-(TTimeIntervalMicroSeconds32aMicroSecond)const

Parameters

TTimeIntervalMicroSeconds32 aMicroSecond

operator-=(TTimeIntervalYears)

IMPORT_C TTime &operator-=(TTimeIntervalYearsaYear)

Parameters

TTimeIntervalYears aYear

operator-=(TTimeIntervalMonths)

IMPORT_C TTime &operator-=(TTimeIntervalMonthsaMonth)

Parameters

TTimeIntervalMonths aMonth

operator-=(TTimeIntervalDays)

IMPORT_C TTime &operator-=(TTimeIntervalDaysaDay)

Parameters

TTimeIntervalDays aDay

operator-=(TTimeIntervalHours)

IMPORT_C TTime &operator-=(TTimeIntervalHoursaHour)

Parameters

TTimeIntervalHours aHour

operator-=(TTimeIntervalMinutes)

IMPORT_C TTime &operator-=(TTimeIntervalMinutesaMinute)

Parameters

TTimeIntervalMinutes aMinute

operator-=(TTimeIntervalSeconds)

IMPORT_C TTime &operator-=(TTimeIntervalSecondsaSecond)

Parameters

TTimeIntervalSeconds aSecond

operator-=(TTimeIntervalMicroSeconds)

IMPORT_C TTime &operator-=(TTimeIntervalMicroSecondsaMicroSecond)

Parameters

TTimeIntervalMicroSeconds aMicroSecond

operator-=(TTimeIntervalMicroSeconds32)

IMPORT_C TTime &operator-=(TTimeIntervalMicroSeconds32aMicroSecond)

Parameters

TTimeIntervalMicroSeconds32 aMicroSecond

operator<(TTime)

TBool operator<(TTimeaTime)const [inline]

Tests whether this date/time is earlier than the specified date/time.

True if this date/time is earlier than the specified date/time. False otherwise.

Parameters

TTime aTimeThe date/time to be compared with this date/time.

operator<=(TTime)

TBool operator<=(TTimeaTime)const [inline]

Tests whether this date/time is earlier than or the same as the specified date/time.

True if this date/time is earlier than or the same as the specified date/time. False otherwise.

Parameters

TTime aTimeThe date/time to be compared with this date/time.

operator=(const TInt64 &)

TTime &operator=(const TInt64 &aTime)[inline]

Assigns a value contained in a 64-bit integer to this TTime object.

This TTime object.

Parameters

const TInt64 & aTimeMicrosecond value which to assign to the TTime object.

operator=(const TDateTime &)

IMPORT_C TTime &operator=(const TDateTime &aDateTime)

Parameters

const TDateTime & aDateTime

operator==(TTime)

TBool operator==(TTimeaTime)const [inline]

Tests whether two date/times are equal.

True if the two TTimes are equal. False if not.

Parameters

TTime aTimeThe time to be compared with this TTime.

operator>(TTime)

TBool operator>(TTimeaTime)const [inline]

Tests whether this date/time is later than the specified date/time.

True if this date/time is later than the specified date/time. False otherwise.

Parameters

TTime aTimeThe date/time to be compared with this date/time.

operator>=(TTime)

TBool operator>=(TTimeaTime)const [inline]

Tests whether this date/time is later than or the same as the specified date/time.

True if this date/time is later than or the same as the specified date/time. False otherwise.

Parameters

TTime aTimeThe date/time to be compared with this date/time.

Member Data Documentation

__DECLARE_TEST

__DECLARE_TEST[private]

TInt64 iTime

TInt64 iTime[private]