Xpace
Xpace::Time Class Reference

#include <datetime.h>

Public Types

enum  { maxLength = 18 }
 

Public Member Functions

 Time ()
 
 Time (uint hour, uint minute, uint second, uint precision=0, uint fraction=0)
 
 Time (uint hmsf, uint precision=0)
 
 Time (const String &str, const String &format)
 
void set (uint hour, uint minute, uint second, uint precision=0, uint fraction=0)
 
void setHMSF (uint hmsf, uint precision=0)
 
uint getHour () const
 
uint getMinute () const
 
uint getSecond () const
 
uint getPrecision () const
 
uint getFraction () const
 
uint getMillisecond () const
 
uint getHMSF (uint precision=0) const
 
uint toUint (uint precision=0) const
 
void toString (String16 *buf, uint precision=~0, bool sep=false, bool dec=false) const
 
String toString (const String &format) const
 
Timeoperator+= (int delta)
 increment/decrement the time More...
 

Static Public Member Functions

static Time fromUint (uint val, uint precision=0)
 

Friends

class DateTime
 

Detailed Description

Definition at line 110 of file datetime.h.

Member Enumeration Documentation

anonymous enum
Enumerator
maxLength 

Definition at line 194 of file datetime.h.

Constructor & Destructor Documentation

Xpace::Time::Time ( )
inline

Definition at line 302 of file datetime.h.

References Xpace::DateTime::getDate().

Referenced by Xpace::Date::Date().

Xpace::Time::Time ( uint  hour,
uint  minute,
uint  second,
uint  precision = 0,
uint  fraction = 0 
)
Parameters
hourthe hour [0..23]
minutethe minute [0..59]
secondthe second [0..60]
precision0 = seconds, 1 = tenths, 2 = hundredths, 3 = milliseconds
fractionnumber of tenths, hundredths, milliseconds
Xpace::Time::Time ( uint  hmsf,
uint  precision = 0 
)
Parameters
thetime in hhmmssfff format
precision0 = seconds, 1 = tenths, 2 = hundredths, 3 = milliseconds
Xpace::Time::Time ( const String str,
const String format 
)
Parameters
thetime in string form
formatthe format of the time e.g. "hh:mm:ss"

Member Function Documentation

void Xpace::Time::set ( uint  hour,
uint  minute,
uint  second,
uint  precision = 0,
uint  fraction = 0 
)
Parameters
hourthe hour (0..23)
minutethe minute (0..59)
secondthe second (0..60)
precision0 = seconds, 1 = tenths, 2 = hundredths, 3 = milliseconds
fractionnumber of tenths, hundredths, millisecondseconds
void Xpace::Time::setHMSF ( uint  hmsf,
uint  precision = 0 
)
uint Xpace::Time::getHour ( ) const
uint Xpace::Time::getMinute ( ) const
uint Xpace::Time::getSecond ( ) const
uint Xpace::Time::getPrecision ( ) const
uint Xpace::Time::getFraction ( ) const
uint Xpace::Time::getMillisecond ( ) const
uint Xpace::Time::getHMSF ( uint  precision = 0) const
Parameters
precisionforce this precision
Returns
time in hhmmssfff format
uint Xpace::Time::toUint ( uint  precision = 0) const
Parameters
usethis precision
Returns
seconds * 10^precision + fraction
static Time Xpace::Time::fromUint ( uint  val,
uint  precision = 0 
)
static
Parameters
valseconds + 10^precision + fraction
precisionforce this precision
void Xpace::Time::toString ( String16 buf,
uint  precision = ~0,
bool  sep = false,
bool  dec = false 
) const
Parameters
precisionforce this precision; if ~0, use internal precision
Return values
bufthe buffer into which to store the time (and its length)
String Xpace::Time::toString ( const String format) const
Parameters
formatthe format of the time e.g. "hh:mm:ss"
Time& Xpace::Time::operator+= ( int  delta)

increment/decrement the time

Parameters
incrementthe time by this many units if precision == 0, unit = second; if precision = 1, unit = tenths; etc. wrap on under/overflow

Friends And Related Function Documentation

friend class DateTime
friend

Definition at line 112 of file datetime.h.


The documentation for this class was generated from the following file:

current as of Wed Jun 10 2026 12:00:06