Zen API
 All Classes Files Functions Variables Typedefs Friends Macros Modules Pages
kTimeSpan Class Reference

Description

Represents a span of time.

kTimeSpan is a type alias for a 64-bit signed integer that represents a count of elapsed microseconds.

Methods are provided for converting to/from broken-down time parts. Support is also provided to format/parse time span values to/from a small number of different text representations.

kTimeSpan elapsed = kDateTime_Now() - then;
kText64 elapsedText;
kCheck(kTimeSpan_Format(elapsed, kTIME_SPAN_FORMAT_PARTS_FULL, elapsedText, sizeof(elapsedText)));
kLogf("Elapsed time: %s", elapsedText);
kLogf("Elapsed time in hours: %f", kTimeSpan_ToHours64f(elapsed));

kTimeSpan supports the kdat6 serialization protocol.

kTimeSpan overrides kValue_Equals and kValue_HashCode.

Inheritance diagram for kTimeSpan:
Inheritance graph

Related

k32s kTimeSpan_DaysPart (kTimeSpan span)
 Gets broken-down days component of the timespan. More...
 
kStatus kTimeSpan_Format (kTimeSpan span, kTimeSpanFormat format, kChar *text, kSize capacity)
 Formats a time span value as a string. More...
 
kTimeSpan kTimeSpan_FromDays64f (k64f days)
 Creates a timespan from a total number of days. More...
 
kTimeSpan kTimeSpan_FromDays64s (k64s days)
 Creates a timespan from a total number of days. More...
 
kTimeSpan kTimeSpan_FromHours64f (k64f hours)
 Creates a timespan from a total number of hours. More...
 
kTimeSpan kTimeSpan_FromHours64s (k64s hours)
 Creates a timespan from a total number of hours. More...
 
kTimeSpan kTimeSpan_FromMicroseconds64f (k64f microseconds)
 Creates a timespan from a total number of microseconds. More...
 
kTimeSpan kTimeSpan_FromMicroseconds64s (k64s microseconds)
 Creates a timespan from a total number of microseconds. More...
 
kTimeSpan kTimeSpan_FromMilliseconds64f (k64f milliseconds)
 Creates a timespan from a total number of milliseconds. More...
 
kTimeSpan kTimeSpan_FromMilliseconds64s (k64s milliseconds)
 Creates a timespan from a total number of milliseconds. More...
 
kTimeSpan kTimeSpan_FromMinutes64f (k64f minutes)
 Creates a timespan from a total number of minutes. More...
 
kTimeSpan kTimeSpan_FromMinutes64s (k64s minutes)
 Creates a timespan from a total number of minutes. More...
 
kTimeSpan kTimeSpan_FromParts (k32s daysPart, k32s hoursPart, k32s minutesPart, k32s secondsPart, k32s microsecondsPart)
 Creates a timespan from broken-down time components. More...
 
kTimeSpan kTimeSpan_FromSeconds64f (k64f seconds)
 Creates a timespan from a total number of seconds. More...
 
kTimeSpan kTimeSpan_FromSeconds64s (k64s seconds)
 Creates a timespan from a total number of seconds. More...
 
k32s kTimeSpan_HoursPart (kTimeSpan span)
 Gets broken-down hours component of the timespan. More...
 
k32s kTimeSpan_MicrosecondsPart (kTimeSpan span)
 Gets broken-down microseconds component of timespan. More...
 
k32s kTimeSpan_MinutesPart (kTimeSpan span)
 Gets broken-down minutes component of the timespan. More...
 
kStatus kTimeSpan_Parse (kTimeSpan *span, kTimeSpanFormat format, const kChar *text)
 Parses a time string that was formatted with kTimeSpan_Format. More...
 
kStatus kTimeSpan_Parts (kTimeSpan span, k32s *daysPart, k32s *hoursPart, k32s *minutesPart, k32s *secondsPart, k32s *microsecondsPart)
 Gets broken-down time components from a timespan. More...
 
k32s kTimeSpan_SecondsPart (kTimeSpan span)
 Gets broken-down seconds component of the timespan. More...
 
k64f kTimeSpan_ToDays64f (kTimeSpan span)
 Reports the total days represented by the timespan. More...
 
k64s kTimeSpan_ToDays64s (kTimeSpan span)
 Reports the total days represented by the timespan. More...
 
k64f kTimeSpan_ToHours64f (kTimeSpan span)
 Reports the total hours represented by the timespan. More...
 
k64s kTimeSpan_ToHours64s (kTimeSpan span)
 Reports the total hours represented by the timespan. More...
 
k64f kTimeSpan_ToMicroseconds64f (kTimeSpan span)
 Reports the total microseconds represented by the timespan. More...
 
k64s kTimeSpan_ToMicroseconds64s (kTimeSpan span)
 Reports the total microseconds represented by the timespan. More...
 
k64f kTimeSpan_ToMilliseconds64f (kTimeSpan span)
 Reports the total milliseconds represented by the timespan. More...
 
k64s kTimeSpan_ToMilliseconds64s (kTimeSpan span)
 Reports the total milliseconds represented by the timespan. More...
 
k64f kTimeSpan_ToMinutes64f (kTimeSpan span)
 Reports the total minutes represented by the timespan. More...
 
k64s kTimeSpan_ToMinutes64s (kTimeSpan span)
 Reports the total minutes represented by the timespan. More...
 
k64f kTimeSpan_ToSeconds64f (kTimeSpan span)
 Reports the total seconds represented by the timespan. More...
 
k64s kTimeSpan_ToSeconds64s (kTimeSpan span)
 Reports the total seconds represented by the timespan. More...
 

Additional Inherited Members

- Public Member Functions inherited from kValue
kBool kValue_Equals (kType type, const void *value, const void *other)
 Determines whether a value is equal to another value. More...
 
kSize kValue_HashCode (kType type, const void *value)
 Gets a hash code representing the state of this value. More...
 
void kValue_Import (kType type, void *value, const void *source)
 Imports the content of another value into this value. More...
 
- Protected Member Functions inherited from kValue
kBool kValue_VEquals (kType type, const void *value, const void *other)
 Protected virtual method that compares two values for equality. More...
 
kSize kValue_VHashCode (kType type, const void *value)
 Protected virtual method that calculates a hash code representing the value instance. More...
 
void kValue_VImport (kType type, void *value, const void *source)
 Protected virtual method that imports data from an external source into an array-value type. More...
 

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