10 #ifndef K_API_TIME_SPAN_H
11 #define K_API_TIME_SPAN_H
25 #define kTIME_SPAN_FORMAT_NULL (0)
26 #define kTIME_SPAN_FORMAT_PARTS_FULL (1)
27 #define kTIME_SPAN_FORMAT_PARTS_SIMPLE (2)
28 #define kTIME_SPAN_FORMAT_HMS_FULL (3)
29 #define kTIME_SPAN_FORMAT_HMS_SIMPLE (4)
60 typedef k64s kTimeSpan;
62 #include <kApi/Utils/kTimeSpan.x.h>
77 return (((daysPart*24LL + hoursPart)*60LL + minutesPart)*60LL + secondsPart)*1000000LL + microsecondsPart;
103 return (
k32s) (span / (24LL * 60LL * 60LL * 1000000LL));
115 return (
k32s) ((span / (60LL * 60LL * 1000000LL)) % 24LL);
127 return (
k32s) ((span / (60LL * 1000000LL)) % 60LL);
139 return (
k32s) ((span / 1000000LL) % 60LL);
151 return (
k32s) (span % 1000000LL);
163 return days * 24LL * 60LL * 60LL * 1000000LL;
187 return hours * 60LL * 60LL * 1000000LL;
211 return minutes * 60LL * 1000000LL;
235 return seconds * 1000000LL;
259 return milliseconds * 1000LL;
307 return span / (24LL * 60LL * 60LL * 1000000LL);
319 return (
k64f)span / (24.0 * 60.0 * 60.0 * 1000000.0);
331 return span / (60LL * 60LL * 1000000LL);
343 return (
k64f)span / (60.0 * 60.0 * 1000000.0);
355 return span / (60LL * 1000000LL);
367 return (
k64f)span / (60.0 * 1000000.0);
379 return span / 1000000LL;
391 return (
k64f)span / 1000000.0;
403 return span / 1000LL;
415 return (
k64f)span / 1000.0;
k64f kTimeSpan_ToDays64f(kTimeSpan span)
Reports the total days represented by the timespan.
Definition: kTimeSpan.h:317
kTimeSpan kTimeSpan_FromHours64f(k64f hours)
Creates a timespan from a total number of hours.
Definition: kTimeSpan.h:197
k64s kTimeSpan_ToSeconds64s(kTimeSpan span)
Reports the total seconds represented by the timespan.
Definition: kTimeSpan.h:377
k32s kTimeSpan_HoursPart(kTimeSpan span)
Gets broken-down hours component of the timespan.
Definition: kTimeSpan.h:113
kTimeSpan kTimeSpan_FromSeconds64f(k64f seconds)
Creates a timespan from a total number of seconds.
Definition: kTimeSpan.h:245
kTimeSpan kTimeSpan_FromMicroseconds64f(k64f microseconds)
Creates a timespan from a total number of microseconds.
Definition: kTimeSpan.h:293
Represents an unsigned integer that can store a pointer address.
k64f kTimeSpan_ToHours64f(kTimeSpan span)
Reports the total hours represented by the timespan.
Definition: kTimeSpan.h:341
kTimeSpan kTimeSpan_FromMilliseconds64f(k64f milliseconds)
Creates a timespan from a total number of milliseconds.
Definition: kTimeSpan.h:269
k64s kTimeSpan_ToDays64s(kTimeSpan span)
Reports the total days represented by the timespan.
Definition: kTimeSpan.h:305
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:26
Represents a single unit (byte) in a UTF-8 character.
kTimeSpan kTimeSpan_FromParts(k32s daysPart, k32s hoursPart, k32s minutesPart, k32s secondsPart, k32s microsecondsPart)
Creates a timespan from broken-down time components.
Definition: kTimeSpan.h:75
k64f kTimeSpan_ToMicroseconds64f(kTimeSpan span)
Reports the total microseconds represented by the timespan.
Definition: kTimeSpan.h:437
kTimeSpan kTimeSpan_FromMicroseconds64s(k64s microseconds)
Creates a timespan from a total number of microseconds.
Definition: kTimeSpan.h:281
k64f kTimeSpan_ToMilliseconds64f(kTimeSpan span)
Reports the total milliseconds represented by the timespan.
Definition: kTimeSpan.h:413
k64s kTimeSpan_ToHours64s(kTimeSpan span)
Reports the total hours represented by the timespan.
Definition: kTimeSpan.h:329
kTimeSpan kTimeSpan_FromMilliseconds64s(k64s milliseconds)
Creates a timespan from a total number of milliseconds.
Definition: kTimeSpan.h:257
kTimeSpan kTimeSpan_FromSeconds64s(k64s seconds)
Creates a timespan from a total number of seconds.
Definition: kTimeSpan.h:233
k32s kTimeSpan_MinutesPart(kTimeSpan span)
Gets broken-down minutes component of the timespan.
Definition: kTimeSpan.h:125
k64s kTimeSpan_ToMilliseconds64s(kTimeSpan span)
Reports the total milliseconds represented by the timespan.
Definition: kTimeSpan.h:401
kTimeSpan kTimeSpan_FromMinutes64f(k64f minutes)
Creates a timespan from a total number of minutes.
Definition: kTimeSpan.h:221
#define kMath_Round64s_(A)
Rounds a floating-point value and casts to an 64-bit signed integer.
Definition: kMath.h:45
k64f kTimeSpan_ToSeconds64f(kTimeSpan span)
Reports the total seconds represented by the timespan.
Definition: kTimeSpan.h:389
k64f kTimeSpan_ToMinutes64f(kTimeSpan span)
Reports the total minutes represented by the timespan.
Definition: kTimeSpan.h:365
Core Zen type declarations.
Represents a 32-bit signed integer.
k64s kTimeSpan_ToMicroseconds64s(kTimeSpan span)
Reports the total microseconds represented by the timespan.
Definition: kTimeSpan.h:425
kStatus kTimeSpan_Parts(kTimeSpan span, k32s *daysPart, k32s *hoursPart, k32s *minutesPart, k32s *secondsPart, k32s *microsecondsPart)
Gets broken-down time components from a timespan.
kTimeSpan kTimeSpan_FromHours64s(k64s hours)
Creates a timespan from a total number of hours.
Definition: kTimeSpan.h:185
Represents a 64-bit signed integer.
kStatus kTimeSpan_Parse(kTimeSpan *span, kTimeSpanFormat format, const kChar *text)
Parses a time string that was formatted with kTimeSpan_Format.
k32s kTimeSpan_DaysPart(kTimeSpan span)
Gets broken-down days component of the timespan.
Definition: kTimeSpan.h:101
kTimeSpan kTimeSpan_FromDays64f(k64f days)
Creates a timespan from a total number of days.
Definition: kTimeSpan.h:173
kTimeSpan kTimeSpan_FromMinutes64s(k64s minutes)
Creates a timespan from a total number of minutes.
Definition: kTimeSpan.h:209
k32s kTimeSpan_SecondsPart(kTimeSpan span)
Gets broken-down seconds component of the timespan.
Definition: kTimeSpan.h:137
Represents an error code.
Represents a 64-bit floating-point number.
kStatus kTimeSpan_Format(kTimeSpan span, kTimeSpanFormat format, kChar *text, kSize capacity)
Formats a time span value as a string.
Represents a span of time.
k32s kTimeSpan_MicrosecondsPart(kTimeSpan span)
Gets broken-down microseconds component of timespan.
Definition: kTimeSpan.h:149
k64s kTimeSpan_ToMinutes64s(kTimeSpan span)
Reports the total minutes represented by the timespan.
Definition: kTimeSpan.h:353
kTimeSpan kTimeSpan_FromDays64s(k64s days)
Creates a timespan from a total number of days.
Definition: kTimeSpan.h:161