You.i Engine
CYITimeConversion Class Reference

#include <utility/YiTimeConversion.h>

Public Types

enum  Format {
  Format::ZeroPadded = 0,
  Format::Unpadded
}
 

Static Public Member Functions

static CYIString TimeIntervalToString (uint64_t timeSec, Format timeSpanFormat)
 
static CYIString TimeIntervalToString (uint64_t timeSec, const CYIString &format)
 
static bool HasHours (uint64_t timeSec)
 
static bool HasMinutes (uint64_t timeSec)
 
static bool HasSeconds (uint64_t timeSec)
 
static bool StringToTimeInterval (const CYIString &timeSpan, Format timeSpanFormat, uint64_t *pTimeSec)
 

Member Enumeration Documentation

◆ Format

Enumerator
ZeroPadded 

The time will be padded up to 00:00:00 (hh:mm:ss)

Unpadded 

The time will be minimally expressed. i.e. 1:30:00 instead of 01:30:00

Member Function Documentation

◆ HasHours()

static bool CYITimeConversion::HasHours ( uint64_t  timeSec)
static

Returns true if timeSec is at least one hour.

◆ HasMinutes()

static bool CYITimeConversion::HasMinutes ( uint64_t  timeSec)
static

Returns true if timeSec is at least one minute.

◆ HasSeconds()

static bool CYITimeConversion::HasSeconds ( uint64_t  timeSec)
static

Returns true if timeSec is at least one second.

◆ StringToTimeInterval()

static bool CYITimeConversion::StringToTimeInterval ( const CYIString timeSpan,
Format  timeSpanFormat,
uint64_t *  pTimeSec 
)
static

Populates the given timeSec with the total seconds expressed by timeSpan (formatted as "hh:mm:ss").

returns false if the timeSpan is malformed, if timeSpanFormat is not ZERO_PADDED, or if pTimeSec is null.

◆ TimeIntervalToString() [1/2]

static CYIString CYITimeConversion::TimeIntervalToString ( uint64_t  timeSec,
Format  timeSpanFormat 
)
static
Deprecated:

The provided timeSec will be formatted as a time interval string of the form hh:mm:ss. You can specify zero-padding using timeSpanFormat.

◆ TimeIntervalToString() [2/2]

static CYIString CYITimeConversion::TimeIntervalToString ( uint64_t  timeSec,
const CYIString format 
)
static

Returns a formatted string by taking the provided timeSec and a string, format. The format is composed from components, with h%, m%, and s%

as hours, minutes and seconds. Adding more "h", "m", "s" characters to add the numbers that will be zero-padded. "%hhh%:%mm%:%ss%" with a timSec of 3601 will return "001:00:01",

and "%m%:%ss%" with a timSec of 61 will return "1:01".


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