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 kObject
kAlloc kObject_Alloc (kObject object)
 Gets the memory allocator associated with this object. More...
 
kStatus kObject_Clone (kObject *object, kObject source, kAlloc allocator)
 Constructs a new object by copying an existing object, including any aggregated child elements. More...
 
kStatus kObject_Destroy (kObject object)
 Destroys the object. More...
 
kStatus kObject_Dispose (kObject object)
 Destroys the object and any aggregated child elements. More...
 
kBool kObject_Equals (kObject object, kObject other)
 Determines whether the object is equal to another object. More...
 
kBool kObject_HasForeignData (kObject object)
 Reports whether the object, including aggregated child elements, contains any foreign memory references. More...
 
kSize kObject_HashCode (kObject object)
 Gets a hash code representing the state of this object. More...
 
kBool kObject_Is (kObject object, kType type)
 Determines whether this object is an instance of the specified type. More...
 
kBool kObject_IsShared (kObject object)
 Reports whether the object is currently shared (reference count greater than one). More...
 
kStatus kObject_SetPool (kObject object, kObjectPool pool)
 Sets the object pool associated with this object. More...
 
kStatus kObject_Share (kObject object)
 Increments the reference count associated with this object. More...
 
kSize kObject_Size (kObject object)
 Estimates the memory consumed by this object, including any aggregated child elements. More...
 
kType kObject_Type (kObject object)
 Returns the type of the object. More...
 
- Protected Member Functions inherited from kObject
kStatus kObject_FreeMem (kObject object, void *mem)
 Protected method called by derived classes to free memory using the object's allocator. More...
 
kStatus kObject_FreeMemRef (kObject object, void *mem)
 Protected method called by derived classes to free memory (and reset the provided memory pointer to kNULL) using the object's allocator. More...
 
kStatus kObject_GetMem (kObject object, kSize size, void *mem)
 Protected method called by derived classes to allocate memory using the object's allocator. More...
 
kStatus kObject_GetMemZero (kObject object, kSize size, void *mem)
 Protected method called by derived classes to allocate and zero memory using the object's allocator. More...
 
kStatus kObject_Init (kObject object, kType type, kAlloc alloc)
 Protected method called by derived classes to initialize the kObject base class. More...
 
kStatus kObject_VDisposeItems (kObject object)
 Protected virtual method that destroys any aggregated child objects associated with a collection. More...
 
kBool kObject_VEquals (kObject object, kObject other)
 Protected virtual method that compares two objects for equality. More...
 
kBool kObject_VHasForeignData (kObject object)
 Protected virtual method that reports whether the object, including aggregated child elements, contains any foreign memory references. More...
 
kSize kObject_VHashCode (kObject object)
 Protected virtual method that calculates a hash code representing the object instance. More...
 
kStatus kObject_VInitClone (kObject object, kObject source, kAlloc allocator)
 Protected virtual method that clones (makes a deep copy of) the specified source object. More...
 
kStatus kObject_VRelease (kObject object)
 Protected virtual method that deallocates any resources owned by the object. More...
 
kSize kObject_VSize (kObject object)
 Protected virtual method that calculates the total size (in bytes) of the object instance. More...
 

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