Present  0.9
 All Classes Files Functions Variables Typedefs Friends Macros Pages
day-delta.h File Reference

Go to the source code of this file.

Classes

struct  DayDelta
 Class or struct representing a positive or negative delta of a number of days or weeks. More...
 

Functions

struct DayDelta DayDelta_from_days (int_delta days)
 Create a new DayDelta based on a positive or negative number of days. More...
 
void DayDelta_ptr_from_days (struct DayDelta *const result, int_delta days)
 Create a new DayDelta based on a positive or negative number of days. More...
 
struct DayDelta DayDelta_from_weeks (int_delta weeks)
 Create a new DayDelta based on a positive or negative number of weeks. More...
 
void DayDelta_ptr_from_weeks (struct DayDelta *const result, int_delta weeks)
 Create a new DayDelta based on a positive or negative number of weeks. More...
 
struct DayDelta DayDelta_zero (void)
 Create a new DayDelta initialized to zero days. More...
 
void DayDelta_ptr_zero (struct DayDelta *const result)
 Create a new DayDelta initialized to zero days. More...
 
int_delta DayDelta_days (const struct DayDelta *const self)
 Get the number of days represented by a DayDelta. More...
 
int_delta DayDelta_weeks (const struct DayDelta *const self)
 Get the number of weeks represented by a DayDelta. More...
 
double DayDelta_weeks_decimal (const struct DayDelta *const self)
 Get the number of weeks represented by a DayDelta, with a fractional part if necessary. More...
 
struct TimeDelta DayDelta_to_TimeDelta (const struct DayDelta *const self)
 Convert a DayDelta into an equivalent TimeDelta. More...
 
present_bool DayDelta_is_negative (const struct DayDelta *const self)
 Determine whether a DayDelta is negative. More...
 
void DayDelta_negate (struct DayDelta *const self)
 Negate a DayDelta, making it negative if it was positive or positive if it was negative. More...
 
void DayDelta_multiply_by (struct DayDelta *const self, long scale_factor)
 Scale a DayDelta by multiplying it by a scale factor. More...
 
void DayDelta_divide_by (struct DayDelta *const self, long scale_factor)
 Scale a DayDelta by dividing it by a scale factor. More...
 
void DayDelta_add (struct DayDelta *const self, const struct DayDelta *const other)
 Add another DayDelta to a DayDelta. More...
 
void DayDelta_subtract (struct DayDelta *const self, const struct DayDelta *const other)
 Subtract another DayDelta from a DayDelta. More...
 
short DayDelta_compare (const struct DayDelta *const lhs, const struct DayDelta *const rhs)
 Compare two DayDelta instances. More...
 
short DayDelta_compare_to_TimeDelta (const struct DayDelta *const lhs, const struct TimeDelta *const rhs)
 Compare a DayDelta to a TimeDelta. More...
 
present_bool DayDelta_equal (const struct DayDelta *const lhs, const struct DayDelta *const rhs)
 Determine whether two DayDelta instances are equal (lhs == rhs). More...
 
present_bool DayDelta_equal_TimeDelta (const struct DayDelta *const lhs, const struct TimeDelta *const rhs)
 Determine whether a DayDelta equals a TimeDelta (lhs == rhs). More...
 
present_bool DayDelta_less_than (const struct DayDelta *const lhs, const struct DayDelta *const rhs)
 Determine whether a DayDelta is less than another DayDelta (lhs < rhs). More...
 
present_bool DayDelta_less_than_TimeDelta (const struct DayDelta *const lhs, const struct TimeDelta *const rhs)
 Determine whether a DayDelta is less than a TimeDelta (lhs < rhs). More...
 
present_bool DayDelta_less_than_or_equal (const struct DayDelta *const lhs, const struct DayDelta *const rhs)
 Determine whether a DayDelta is less than or equal to another DayDelta (lhs <= rhs). More...
 
present_bool DayDelta_less_than_or_equal_TimeDelta (const struct DayDelta *const lhs, const struct TimeDelta *const rhs)
 Determine whether a DayDelta is less than or equal to a TimeDelta (lhs <= rhs). More...
 
present_bool DayDelta_greater_than (const struct DayDelta *const lhs, const struct DayDelta *const rhs)
 Determine whether a DayDelta is greater than another DayDelta (lhs > rhs). More...
 
present_bool DayDelta_greater_than_TimeDelta (const struct DayDelta *const lhs, const struct TimeDelta *const rhs)
 Determine whether a DayDelta is greater than a TimeDelta (lhs > rhs). More...
 
present_bool DayDelta_greater_than_or_equal (const struct DayDelta *const lhs, const struct DayDelta *const rhs)
 Determine whether a DayDelta is greater than or equal to another DayDelta (lhs >= rhs). More...
 
present_bool DayDelta_greater_than_or_equal_TimeDelta (const struct DayDelta *const lhs, const struct TimeDelta *const rhs)
 Determine whether a DayDelta is greater than or equal to a TimeDelta (lhs >= rhs). More...
 

Function Documentation

struct DayDelta DayDelta_from_days ( int_delta  days)

Create a new DayDelta based on a positive or negative number of days.

void DayDelta_ptr_from_days ( struct DayDelta *const  result,
int_delta  days 
)

Create a new DayDelta based on a positive or negative number of days.

Parameters
[out]resultA pointer to a struct DayDelta for the result.
struct DayDelta DayDelta_from_weeks ( int_delta  weeks)

Create a new DayDelta based on a positive or negative number of weeks.

void DayDelta_ptr_from_weeks ( struct DayDelta *const  result,
int_delta  weeks 
)

Create a new DayDelta based on a positive or negative number of weeks.

Parameters
[out]resultA pointer to a struct DayDelta for the result.
struct DayDelta DayDelta_zero ( void  )

Create a new DayDelta initialized to zero days.

void DayDelta_ptr_zero ( struct DayDelta *const  result)

Create a new DayDelta initialized to zero days.

Parameters
[out]resultA pointer to a struct DayDelta for the result.
int_delta DayDelta_days ( const struct DayDelta *const  self)

Get the number of days represented by a DayDelta.

int_delta DayDelta_weeks ( const struct DayDelta *const  self)

Get the number of weeks represented by a DayDelta.

If the DayDelta does not represent an exact number of weeks, the number of weeks will be truncated.

double DayDelta_weeks_decimal ( const struct DayDelta *const  self)

Get the number of weeks represented by a DayDelta, with a fractional part if necessary.

struct TimeDelta DayDelta_to_TimeDelta ( const struct DayDelta *const  self)

Convert a DayDelta into an equivalent TimeDelta.

present_bool DayDelta_is_negative ( const struct DayDelta *const  self)

Determine whether a DayDelta is negative.

void DayDelta_negate ( struct DayDelta *const  self)

Negate a DayDelta, making it negative if it was positive or positive if it was negative.

void DayDelta_multiply_by ( struct DayDelta *const  self,
long  scale_factor 
)

Scale a DayDelta by multiplying it by a scale factor.

void DayDelta_divide_by ( struct DayDelta *const  self,
long  scale_factor 
)

Scale a DayDelta by dividing it by a scale factor.

void DayDelta_add ( struct DayDelta *const  self,
const struct DayDelta *const  other 
)

Add another DayDelta to a DayDelta.

The second DayDelta parameter is added to the first.

void DayDelta_subtract ( struct DayDelta *const  self,
const struct DayDelta *const  other 
)

Subtract another DayDelta from a DayDelta.

The second DayDelta parameter is added to the first.

short DayDelta_compare ( const struct DayDelta *const  lhs,
const struct DayDelta *const  rhs 
)

Compare two DayDelta instances.

  • If lhs < rhs, then a negative integer will be returned.
  • If lhs == rhs, then 0 will be returned.
  • If lhs > rhs, then a positive integer will be returned.
short DayDelta_compare_to_TimeDelta ( const struct DayDelta *const  lhs,
const struct TimeDelta *const  rhs 
)

Compare a DayDelta to a TimeDelta.

  • If lhs < rhs, then a negative integer will be returned.
  • If lhs == rhs, then 0 will be returned.
  • If lhs > rhs, then a positive integer will be returned.
present_bool DayDelta_equal ( const struct DayDelta *const  lhs,
const struct DayDelta *const  rhs 
)

Determine whether two DayDelta instances are equal (lhs == rhs).

present_bool DayDelta_equal_TimeDelta ( const struct DayDelta *const  lhs,
const struct TimeDelta *const  rhs 
)

Determine whether a DayDelta equals a TimeDelta (lhs == rhs).

present_bool DayDelta_less_than ( const struct DayDelta *const  lhs,
const struct DayDelta *const  rhs 
)

Determine whether a DayDelta is less than another DayDelta (lhs < rhs).

present_bool DayDelta_less_than_TimeDelta ( const struct DayDelta *const  lhs,
const struct TimeDelta *const  rhs 
)

Determine whether a DayDelta is less than a TimeDelta (lhs < rhs).

present_bool DayDelta_less_than_or_equal ( const struct DayDelta *const  lhs,
const struct DayDelta *const  rhs 
)

Determine whether a DayDelta is less than or equal to another DayDelta (lhs <= rhs).

present_bool DayDelta_less_than_or_equal_TimeDelta ( const struct DayDelta *const  lhs,
const struct TimeDelta *const  rhs 
)

Determine whether a DayDelta is less than or equal to a TimeDelta (lhs <= rhs).

present_bool DayDelta_greater_than ( const struct DayDelta *const  lhs,
const struct DayDelta *const  rhs 
)

Determine whether a DayDelta is greater than another DayDelta (lhs > rhs).

present_bool DayDelta_greater_than_TimeDelta ( const struct DayDelta *const  lhs,
const struct TimeDelta *const  rhs 
)

Determine whether a DayDelta is greater than a TimeDelta (lhs > rhs).

present_bool DayDelta_greater_than_or_equal ( const struct DayDelta *const  lhs,
const struct DayDelta *const  rhs 
)

Determine whether a DayDelta is greater than or equal to another DayDelta (lhs >= rhs).

present_bool DayDelta_greater_than_or_equal_TimeDelta ( const struct DayDelta *const  lhs,
const struct TimeDelta *const  rhs 
)

Determine whether a DayDelta is greater than or equal to a TimeDelta (lhs >= rhs).