CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
Time Manipulation

Data Structures

struct  TimeParts
 Decomposed time structure with individual date/time components. More...
 

Typedefs

typedef struct TimeParts TimeParts
 Decomposed time structure with individual date/time components.
 

Enumerations

enum  WEEKDAYS {
  Sunday = 0 , Monday , Tuesday , Wednesday ,
  Thursday , Friday , Saturday
}
 Days of the week (0-6) More...
 

Functions

bool timeDecompose (TimeParts *out, _In_range_(0, timeForever) int64 time)
 
int64 timeCompose (TimeParts *parts)
 
int64 timeLocal (int64 time, int64 *offset)
 

Variables

strref timeDayName []
 Full names of days of the week (indexed by WEEKDAYS enum)
 
strref timeDayAbbrev []
 Three-letter abbreviations of days of the week (indexed by WEEKDAYS enum)
 
strref timeMonthName []
 Full names of months (indexed 1-12, index 0 is empty string)
 
strref timeMonthAbbrev []
 Three-letter abbreviations of months (indexed 1-12, index 0 is empty string)
 

Detailed Description

Functions for converting, decomposing, and manipulating time values.

Enumeration Type Documentation

◆ WEEKDAYS

enum WEEKDAYS

Days of the week (0-6)

Enumerator
Sunday 

Sunday.

Monday 

Monday.

Tuesday 

Tuesday.

Wednesday 

Wednesday.

Thursday 

Thursday.

Friday 

Friday.

Saturday 

Saturday.

Definition at line 34 of file time.h.

Function Documentation

◆ timeCompose()

int64 timeCompose ( TimeParts parts)

Compose a time value from individual date/time components.

Converts year, month, day, hour, minute, second, and microsecond components into a single microsecond timestamp. The wday and yday fields are ignored.

Parameters
partsPointer to TimeParts structure with time components to compose
Returns
Time value in microseconds since Julian epoch, or 0 if invalid

◆ timeDecompose()

bool timeDecompose ( TimeParts out,
_In_range_(0, timeForever) int64  time 
)

Decompose a time value into individual date/time components.

Converts a microsecond timestamp into year, month, day, hour, minute, second, and microsecond components. Also populates day of week (wday) and day of year (yday) fields for information.

Parameters
outPointer to TimeParts structure to receive the decomposed time
timeTime value in microseconds since Julian epoch
Returns
True if successful, false if time is negative

◆ timeLocal()

int64 timeLocal ( int64  time,
int64 *  offset 
)

Convert a time to local time.

Adjusts the given time for the local time zone rules currently in effect. Optionally returns the offset applied.

Parameters
timeTime value in microseconds since Julian epoch
offsetOptional pointer to receive the offset in microseconds between UTC and local time
Returns
Time value adjusted for local time zone, or 0 on failure