date_compare_time(date1,date2)

From ENIGMA
Jump to navigation Jump to search

Description

Compares the time of the two given date-time values and returns the result.

Parameters

Parameter Data Type Description
date1 time_t first date-time value to compare
date2 time_t second date-time value to compare

Return Values

integer: Returns -1, 0, or 1 depending on whether the first is smaller, equal, or larger than the second value.

Example Call

// demonstrates comparing the date-time value of the current time to 1 hour from now
switch (date_compare_time(date_current_time(), date_inc_hour(date_current_time(),1))) {
  case -1:
    // first date-time value is smaller than the second
    break;
  case 0:
    // first date-time value is equal the second
    break;
  case 1:
    // first date-time value is larger than the second
    break;
}