39 #if defined(HAVE_STRUCT_TM_TM_GMTOFF) 40 # define GMTOFF(tm) ((tm)->tm_gmtoff) 43 # define GMTOFF(tm) (-timezone+daylight) 46 #define HOUR_SECONDS (60 * 60) 47 #define DAY_SECONDS (HOUR_SECONDS * 24) 59 static crm_time_t *parse_date(
const char *date_str);
72 utc->years = dt->years;
74 utc->seconds = dt->seconds;
81 utc->months = dt->months;
98 if (date_time == NULL) {
103 dt = parse_date(date_time);
135 return (t != NULL) && (t->years || t->months || t->days || t->seconds
136 || t->offset || t->duration);
170 int YY = (year - 1) % 100;
171 int C = (year - 1) - YY;
173 int jan1 = 1 + (((((C / 100) % 4) * 5) + G) % 7);
175 crm_trace(
"YY=%d, C=%d, G=%d", YY, C, G);
176 crm_trace(
"January 1 %.4d: %d", year, jan1);
201 static int month_days[13] = {
202 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 29
216 if ((month < 1) || (month > 12)) {
222 return month_days[month - 1];
228 gboolean is_leap = FALSE;
233 if (year % 100 == 0 && year % 400 != 0) {
240 get_ordinal_days(uint32_t y, uint32_t m, uint32_t d)
244 for (lpc = 1; lpc < m; lpc++) {
252 int line,
const char *prefix,
const crm_time_t *date_time,
259 (prefix? prefix :
""), (prefix?
": " :
""), date_s);
262 (prefix? prefix :
""), (prefix?
": " :
""), date_s);
268 crm_time_get_sec(
int sec, uint32_t *h, uint32_t *m, uint32_t *s)
270 uint32_t hours, minutes, seconds;
281 minutes = seconds / 60;
282 seconds -= 60 * minutes;
284 crm_trace(
"%d == %.2d:%.2d:%.2d", sec, hours, minutes, seconds);
295 crm_time_get_sec(dt->seconds, h, m, s);
304 crm_time_get_sec(dt->seconds, h, m, &s);
313 long long in_seconds = 0;
319 utc = crm_get_utc_time(dt);
324 for (lpc = 1; lpc < utc->years; lpc++) {
325 long long dmax = year_days(lpc);
337 if (utc->months > 0) {
338 in_seconds +=
DAY_SECONDS * 30 * (
long long) (utc->months);
342 in_seconds +=
DAY_SECONDS * (
long long) (utc->days - 1);
344 in_seconds += utc->seconds;
350 #define EPOCH_SECONDS 62135596800ULL 365 for (months = 1; months <= 12 && days > 0; months++) {
375 }
else if (dt->months) {
386 crm_trace(
"%.4d-%.3d -> %.4d-%.2d-%.2d", dt->years, dt->days, dt->years, months, days);
413 h = dt->days + jan1 - 1;
414 *d = 1 + ((h - 1) % 7);
417 if (dt->days <= (8 - jan1) && jan1 > 4) {
419 year_num = dt->years - 1;
423 year_num = dt->years;
427 if (year_num == dt->years) {
428 int dmax = year_days(year_num);
429 int correction = 4 - *d;
431 if ((dmax - dt->days) < correction) {
432 crm_trace(
"year++, jan1=%d, i=%d vs. %d", jan1, dmax - dt->days, correction);
433 year_num = dt->years + 1;
439 if (year_num == dt->years) {
440 int j = dt->days + (7 - *d) + (jan1 - 1);
449 crm_trace(
"Converted %.4d-%.3d to %.4d-W%.2d-%d", dt->years, dt->days, *y, *w, *d);
461 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%4d year%s ",
465 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%2d month%s ",
469 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%2d day%s ",
473 if (((offset == 0) || (dt->seconds != 0))
474 && (dt->seconds > -60) && (dt->seconds < 60)) {
475 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%d second%s",
477 }
else if (dt->seconds) {
478 uint32_t h = 0, m = 0, s = 0;
480 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%d seconds (",
482 crm_time_get_sec(dt->seconds, &h, &m, &s);
484 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%u hour%s%s",
488 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%u minute%s%s",
492 offset += snprintf(
result + offset,
DATE_MAX - offset,
"%u second%s",
505 char *result_copy = NULL;
509 if (date_time && date_time->offset
512 utc = crm_get_utc_time(date_time);
519 strcpy(
result,
"<undefined time>");
526 crm_duration_as_string(date_time,
result);
549 "%u-W%.2u-%u", y, w, d);
565 "%.4u-%.2u-%.2u", y, m, d);
571 uint32_t h = 0, m = 0, s = 0;
579 "%.2u:%.2u:%.2u", h, m, s);
583 crm_time_get_sec(dt->offset, &h, &m, &s);
586 ((dt->offset < 0)?
'-' :
'+'), h, m);
595 result_copy = strdup(
result);
612 crm_time_parse_sec(
const char *time_str,
int *
result)
622 rc = sscanf(time_str,
"%d:%d:%d", &hour, &minute, &second);
624 rc = sscanf(time_str,
"%2d%2d%2d", &hour, &minute, &second);
627 crm_err(
"%s is not a valid ISO 8601 time specification", time_str);
632 crm_trace(
"Got valid time: %.2d:%.2d:%.2d", hour, minute, second);
634 if ((hour == 24) && (minute == 0) && (second == 0)) {
636 }
else if (hour >= 24) {
637 crm_err(
"%s is not a valid ISO 8601 time specification " 638 "because %d is not a valid hour", time_str, hour);
643 crm_err(
"%s is not a valid ISO 8601 time specification " 644 "because %d is not a valid minute", time_str, minute);
649 crm_err(
"%s is not a valid ISO 8601 time specification " 650 "because %d is not a valid second", time_str, second);
660 crm_time_parse_offset(
const char *offset_str,
int *offset)
664 if (offset_str == NULL) {
666 #if defined(HAVE_STRUCT_TM_TM_GMTOFF) 667 time_t now = time(NULL);
668 struct tm *now_tm = localtime(&now);
673 if (h_offset < 0 && m_offset < 0) {
674 m_offset = 0 - m_offset;
680 if (offset_str[0] ==
'Z') {
686 if ((offset_str[0] ==
'+') || (offset_str[0] ==
'-')
687 || isdigit((
int)offset_str[0])) {
689 gboolean negate = FALSE;
691 if (offset_str[0] ==
'+') {
693 }
else if (offset_str[0] ==
'-') {
697 if (crm_time_parse_sec(offset_str, offset) == FALSE) {
701 *offset = 0 - *offset;
718 crm_time_parse(
const char *time_str,
crm_time_t *a_time)
721 char *offset_s = NULL;
726 if (crm_time_parse_sec(time_str, &(a_time->seconds)) == FALSE) {
729 offset_s = strstr(time_str,
"Z");
730 if (offset_s == NULL) {
731 offset_s = strstr(time_str,
" ");
733 while (isspace(offset_s[0])) {
740 if (crm_time_parse_offset(offset_s, &(a_time->offset)) == FALSE) {
743 crm_time_get_sec(a_time->offset, &h, &m, &s);
744 crm_trace(
"Got tz: %c%2.d:%.2d", ((a_time->offset < 0)?
'-' :
'+'), h, m);
763 parse_date(
const char *date_str)
765 const char *time_s = NULL;
774 if (pcmk__str_empty(date_str)) {
775 crm_err(
"No ISO 8601 date/time specification given");
779 if ((date_str[0] ==
'T') || (date_str[2] ==
':')) {
782 if (date_str[0] ==
'T') {
783 time_s = date_str + 1;
792 if (!strncasecmp(
"epoch", date_str, 5)
793 && ((date_str[5] ==
'\0') || (date_str[5] ==
'/') || isspace(date_str[5]))) {
801 rc = sscanf(date_str,
"%d-%d-%d", &year, &month, &day);
804 rc = sscanf(date_str,
"%4d%2d%2d", &year, &month, &day);
808 crm_err(
"'%s' is not a valid ISO 8601 date/time specification " 809 "because '%d' is not a valid month", date_str, month);
812 crm_err(
"'%s' is not a valid ISO 8601 date/time specification " 813 "because '%d' is not a valid day of the month",
818 dt->days = get_ordinal_days(year, month, day);
819 crm_trace(
"Parsed Gregorian date '%.4d-%.3d' from date string '%s'",
820 year, dt->days, date_str);
826 rc = sscanf(date_str,
"%d-%d", &year, &day);
828 if (day > year_days(year)) {
829 crm_err(
"'%s' is not a valid ISO 8601 date/time specification " 830 "because '%d' is not a valid day of the year (max %d)",
831 date_str, day, year_days(year));
834 crm_trace(
"Parsed ordinal year %d and days %d from date string '%s'",
835 year, day, date_str);
842 rc = sscanf(date_str,
"%d-W%d-%d", &year, &week, &day);
845 crm_err(
"'%s' is not a valid ISO 8601 date/time specification " 846 "because '%d' is not a valid week of the year (max %d)",
849 }
else if (day < 1 || day > 7) {
850 crm_err(
"'%s' is not a valid ISO 8601 date/time specification " 851 "because '%d' is not a valid day of the week",
867 crm_trace(
"Got year %d (Jan 1 = %d), week %d, and day %d from date string '%s'",
868 year, jan1, week, day, date_str);
884 crm_err(
"'%s' is not a valid ISO 8601 date/time specification", date_str);
889 if (time_s == NULL) {
890 time_s = date_str + strspn(date_str,
"0123456789-W");
891 if ((time_s[0] ==
' ') || (time_s[0] ==
'T')) {
897 if ((time_s != NULL) && (crm_time_parse(time_s, dt) == FALSE)) {
903 crm_err(
"'%s' is not a valid ISO 8601 date/time specification",
920 parse_int(
const char *str,
int field_width,
int upper_bound,
int *
result)
924 int intermediate = 0;
925 gboolean fraction = FALSE;
926 gboolean negate = FALSE;
933 if (str[offset] ==
'T') {
937 if (str[offset] ==
'.' || str[offset] ==
',') {
941 }
else if (str[offset] ==
'-') {
944 }
else if (str[offset] ==
'+' || str[offset] ==
':') {
948 for (; (fraction || lpc < field_width) && isdigit((
int)str[offset]); lpc++) {
950 intermediate = (str[offset] -
'0') / (10 ^ lpc);
953 intermediate = str[offset] -
'0';
961 }
else if (upper_bound > 0 && *
result > upper_bound) {
968 crm_trace(
"Found int: %d. Stopped at str[%d]='%c'", *
result, lpc, str[lpc]);
988 gboolean is_time = FALSE;
991 if (pcmk__str_empty(period_s)) {
992 crm_err(
"No ISO 8601 time duration given");
995 if (period_s[0] !=
'P') {
996 crm_err(
"'%s' is not a valid ISO 8601 time duration " 997 "because it does not start with a 'P'", period_s);
1000 if ((period_s[1] ==
'\0') || isspace(period_s[1])) {
1001 crm_err(
"'%s' is not a valid ISO 8601 time duration " 1002 "because nothing follows 'P'", period_s);
1007 diff->duration = TRUE;
1009 for (
const char *current = period_s + 1;
1010 current[0] && (current[0] !=
'/') && !isspace(current[0]);
1015 if (current[0] ==
'T') {
1025 rc = parse_int(current, 10, 0, &an_int);
1027 crm_err(
"'%s' is not a valid ISO 8601 time duration " 1028 "because no integer at '%s'", period_s, current);
1034 switch (current[0]) {
1036 diff->years = an_int;
1041 diff->seconds += an_int * 60;
1043 diff->months = an_int;
1047 diff->days += an_int * 7;
1050 diff->days += an_int;
1056 diff->seconds += an_int;
1059 crm_err(
"'%s' is not a valid ISO 8601 time duration " 1060 "because no units after %d", period_s, an_int);
1063 crm_err(
"'%s' is not a valid ISO 8601 time duration " 1064 "because '%c' is not a valid time unit",
1065 period_s, current[0]);
1071 crm_err(
"'%s' is not a valid ISO 8601 time duration " 1072 "because no amounts and units given", period_s);
1096 const char *original = period_str;
1099 if (pcmk__str_empty(period_str)) {
1100 crm_err(
"No ISO 8601 time period given");
1108 if (period_str[0] ==
'P') {
1110 if (period->
diff == NULL) {
1114 period->
start = parse_date(period_str);
1115 if (period->
start == NULL) {
1120 period_str = strstr(original,
"/");
1123 if (period_str[0] ==
'P') {
1124 if (period->
diff != NULL) {
1125 crm_err(
"'%s' is not a valid ISO 8601 time period " 1126 "because it has two durations",
1131 if (period->
diff == NULL) {
1135 period->
end = parse_date(period_str);
1136 if (period->
end == NULL) {
1141 }
else if (period->
diff != NULL) {
1147 crm_err(
"'%s' is not a valid ISO 8601 time period " 1148 "because it has no duration or ending time",
1153 if (period->
start == NULL) {
1156 }
else if (period->
end == NULL) {
1161 crm_err(
"'%s' is not a valid ISO 8601 time period " 1162 "because the start is invalid", period_str);
1166 crm_err(
"'%s' is not a valid ISO 8601 time period " 1167 "because the end is invalid", period_str);
1202 target->years = source->years;
1203 target->days = source->days;
1204 target->months = source->months;
1205 target->seconds = source->seconds;
1206 target->offset = source->offset;
1226 target->duration = FALSE;
1228 if (source->tm_year > 0) {
1230 target->years = 1900 + source->tm_year;
1233 if (source->tm_yday >= 0) {
1235 target->days = 1 + source->tm_yday;
1238 if (source->tm_hour >= 0) {
1241 if (source->tm_min >= 0) {
1242 target->seconds += 60 * source->tm_min;
1244 if (source->tm_sec >= 0) {
1245 target->seconds += source->tm_sec;
1251 crm_trace(
"Time offset is %lds (%.2d:%.2d)",
1252 GMTOFF(source), h_offset, m_offset);
1255 target->offset += 60 * m_offset;
1261 ha_set_tm_time(
target, localtime(source));
1279 if ((dt == NULL) || (value == NULL)) {
1286 utc = crm_get_utc_time(value);
1292 answer->years += utc->years;
1307 if ((dt == NULL) || (value == NULL)) {
1312 utc = crm_get_utc_time(value);
1317 answer = crm_get_utc_time(dt);
1318 if (answer == NULL) {
1322 answer->duration = TRUE;
1324 answer->years -= utc->years;
1325 if(utc->months != 0) {
1341 if ((dt == NULL) || (value == NULL)) {
1346 utc = crm_get_utc_time(value);
1352 answer->years -= utc->years;
1353 if(utc->months != 0) {
1374 && (dt->days > 0) && (dt->days <= year_days(dt->years))
1375 && (dt->seconds >= 0) && (dt->seconds <
DAY_SECONDS);
1378 #define do_cmp_field(l, r, field) \ 1380 if(l->field > r->field) { \ 1381 crm_trace("%s: %d > %d", \ 1382 #field, l->field, r->field); \ 1384 } else if(l->field < r->field) { \ 1385 crm_trace("%s: %d < %d", \ 1386 #field, l->field, r->field); \ 1398 if ((t1 == NULL) && (t2 == NULL)) {
1400 }
else if (t1 == NULL) {
1402 }
else if (t2 == NULL) {
1426 crm_trace(
"Adding %d seconds to %d (max=%d)",
1428 a_time->seconds += extra;
1433 if (a_time->seconds < 0) {
1444 int lower_bound = 1;
1447 crm_trace(
"Adding %d days to %.4d-%.3d", extra, a_time->years, a_time->days);
1449 a_time->days += extra;
1450 while (a_time->days > ydays) {
1452 a_time->days -= ydays;
1456 if(a_time->duration) {
1460 while (a_time->days < lower_bound) {
1470 uint32_t y, m, d, dmax;
1473 crm_trace(
"Adding %d months to %.4d-%.2d-%.2d", extra, y, m, d);
1476 for (lpc = extra; lpc > 0; lpc--) {
1484 for (lpc = -extra; lpc > 0; lpc--) {
1499 crm_trace(
"Calculated %.4d-%.2d-%.2d", y, m, d);
1502 a_time->days = get_ordinal_days(y, m, d);
1505 crm_trace(
"Got %.4d-%.2d-%.2d", y, m, d);
1529 a_time->years += extra;
1536 .tm_year = source->years - 1900,
1537 .tm_mday = source->days,
1538 .tm_sec = source->seconds % 60,
1539 .tm_min = ( source->seconds / 60 ) % 60,
1544 .tm_gmtoff = source->offset
1570 .months = dt->months,
1572 .seconds = dt->seconds,
1573 .offset = dt->offset,
1574 .duration = dt->duration
1586 .years = hr_dt->
years,
1588 .days = hr_dt->
days,
1610 qb_util_timespec_from_epoch_get(&tv);
1611 if (epoch != NULL) {
1617 hr->
useconds = tv.tv_nsec / QB_TIME_NS_IN_USEC;
1627 if (date_time == NULL) {
1632 dt = parse_date(date_time);
1649 int max = 128, scanned_pos = 0, printed_pos = 0, fmt_pos = 0,
1650 date_len = 0, nano_digits = 0;
1651 char nano_s[10], date_s[max+1], nanofmt_s[5] =
"%", *tmp_fmt_s;
1659 ha_get_tm_time(&tm, &dt);
1660 sprintf(nano_s,
"%06d000", hr_dt->
useconds);
1662 while ((format[scanned_pos]) !=
'\0') {
1663 mark_s = strchr(&format[scanned_pos],
'%');
1667 fmt_pos = mark_s - format;
1668 while ((format[fmt_pos+fmt_len] !=
'\0') &&
1669 (format[fmt_pos+fmt_len] >=
'0') &&
1670 (format[fmt_pos+fmt_len] <=
'9')) {
1673 scanned_pos = fmt_pos + fmt_len + 1;
1674 if (format[fmt_pos+fmt_len] ==
'N') {
1675 nano_digits = atoi(&format[fmt_pos+1]);
1676 nano_digits = (nano_digits > 6)?6:nano_digits;
1677 nano_digits = (nano_digits < 0)?0:nano_digits;
1678 sprintf(&nanofmt_s[1],
".%ds", nano_digits);
1680 if (format[scanned_pos] !=
'\0') {
1683 fmt_pos = scanned_pos;
1686 scanned_pos = strlen(format);
1687 fmt_pos = scanned_pos;
1689 tmp_fmt_s =
strndup(&format[printed_pos], fmt_pos - printed_pos);
1690 #ifdef HAVE_FORMAT_NONLITERAL 1691 #pragma GCC diagnostic push 1692 #pragma GCC diagnostic ignored "-Wformat-nonliteral" 1694 date_len += strftime(&date_s[date_len], max-date_len, tmp_fmt_s, &tm);
1695 #ifdef HAVE_FORMAT_NONLITERAL 1696 #pragma GCC diagnostic pop 1698 printed_pos = scanned_pos;
1701 #ifdef HAVE_FORMAT_NONLITERAL 1702 #pragma GCC diagnostic push 1703 #pragma GCC diagnostic ignored "-Wformat-nonliteral" 1705 date_len += snprintf(&date_s[date_len], max-date_len,
1707 #ifdef HAVE_FORMAT_NONLITERAL 1708 #pragma GCC diagnostic pop 1714 return (date_len == 0)?NULL:strdup(date_s);
1732 char *since_epoch = NULL;
1735 time_t a_time = time(NULL);
1737 if (a_time == (time_t) -1) {
1740 since_epoch = ctime(&a_time);
1743 since_epoch = ctime(when);
1746 if (since_epoch == NULL) {
1767 #define MS_IN_S (1000) 1768 #define MS_IN_M (MS_IN_S * 60) 1769 #define MS_IN_H (MS_IN_M * 60) 1770 #define MS_IN_D (MS_IN_H * 24) 1771 #define MAXSTR sizeof("..d..h..m..s...ms") 1772 static char str[
MAXSTR] = {
'\0', };
1776 offset += snprintf(str + offset,
MAXSTR - offset,
"%ud",
1781 offset += snprintf(str + offset,
MAXSTR - offset,
"%uh",
1786 offset += snprintf(str + offset,
MAXSTR - offset,
"%um",
1793 offset += snprintf(str + offset,
MAXSTR - offset,
"%u",
1796 if (interval_ms > 0) {
1797 offset += snprintf(str + offset,
MAXSTR - offset,
".%03u",
1800 (void) snprintf(str + offset,
MAXSTR - offset,
"s");
1802 }
else if (interval_ms > 0) {
1803 (void) snprintf(str + offset,
MAXSTR - offset,
"%ums", interval_ms);
1805 }
else if (str[0] ==
'\0') {
int crm_time_get_gregorian(const crm_time_t *dt, uint32_t *y, uint32_t *m, uint32_t *d)
#define CRM_CHECK(expr, failure_action)
void crm_time_set_timet(crm_time_t *target, const time_t *source)
bool crm_time_leapyear(int year)
void crm_time_log_alias(int log_level, const char *file, const char *function, int line, const char *prefix, const crm_time_t *date_time, int flags)
void pcmk__time_hr_free(pcmk__time_hr_t *hr_dt)
#define crm_time_log_timeofday
crm_time_t * crm_time_new(const char *date_time)
struct crm_time_s crm_time_t
bool crm_time_check(const crm_time_t *dt)
Check whether a time object represents a sensible date/time.
void crm_time_add_minutes(crm_time_t *a_time, int extra)
crm_time_t * crm_time_calculate_duration(const crm_time_t *dt, const crm_time_t *value)
const char * pcmk__readable_interval(guint interval_ms)
void crm_time_add_weeks(crm_time_t *a_time, int extra)
int crm_time_get_timezone(const crm_time_t *dt, uint32_t *h, uint32_t *m)
long long crm_time_get_seconds_since_epoch(const crm_time_t *dt)
void crm_time_set(crm_time_t *target, const crm_time_t *source)
int crm_time_compare(const crm_time_t *a, const crm_time_t *b)
void crm_time_free(crm_time_t *dt)
#define do_cmp_field(l, r, field)
#define do_crm_log_alias(level, file, function, line, fmt, args...)
Log a message as if it came from a different code location.
crm_time_t * crm_time_add(const crm_time_t *dt, const crm_time_t *value)
#define crm_time_log_duration
char * strndup(const char *str, size_t len)
char * crm_time_as_string(const crm_time_t *date_time, int flags)
pcmk__time_hr_t * pcmk__time_hr_now(time_t *epoch)
long long crm_time_get_seconds(const crm_time_t *dt)
pcmk__time_hr_t * pcmk__time_hr_new(const char *date_time)
struct pcmk__time_us pcmk__time_hr_t
void pcmk__time_set_hr_dt(crm_time_t *target, const pcmk__time_hr_t *hr_dt)
crm_time_period_t * crm_time_parse_period(const char *period_str)
Parse a time period from an ISO 8601 interval specification.
void crm_time_add_seconds(crm_time_t *a_time, int extra)
Add a given number of seconds to a date/time or duration.
crm_time_t * pcmk_copy_time(const crm_time_t *source)
void crm_time_add_days(crm_time_t *a_time, int extra)
#define crm_trace(fmt, args...)
const char * pcmk__epoch2str(const time_t *when)
#define pcmk_is_set(g, f)
Convenience alias for pcmk_all_flags_set(), to check single flag.
int crm_time_get_ordinal(const crm_time_t *dt, uint32_t *y, uint32_t *d)
crm_time_t * crm_time_parse_duration(const char *period_s)
Parse a time duration from an ISO 8601 duration specification.
int crm_time_get_timeofday(const crm_time_t *dt, uint32_t *h, uint32_t *m, uint32_t *s)
void crm_time_add_hours(crm_time_t *a_time, int extra)
#define crm_time_log(level, prefix, dt, flags)
int crm_time_days_in_month(int month, int year)
Return number of days in given month of given year.
#define crm_time_log_with_timezone
crm_time_t * crm_time_new_undefined(void)
Allocate memory for an uninitialized time object.
char * pcmk__time_format_hr(const char *format, const pcmk__time_hr_t *hr_dt)
crm_time_t * crm_time_subtract(const crm_time_t *dt, const crm_time_t *value)
int crm_time_get_isoweek(const crm_time_t *dt, uint32_t *y, uint32_t *w, uint32_t *d)
void crm_time_add_years(crm_time_t *a_time, int extra)
bool crm_time_is_defined(const crm_time_t *t)
Check whether a time object has been initialized yet.
#define HAVE_STRUCT_TM_TM_GMTOFF
pcmk__action_result_t result
#define crm_err(fmt, args...)
void crm_time_add_months(crm_time_t *a_time, int extra)
int crm_time_weeks_in_year(int year)
int crm_time_january1_weekday(int year)
#define pcmk__plural_s(i)
pcmk__time_hr_t * pcmk__time_hr_convert(pcmk__time_hr_t *target, const crm_time_t *dt)
char * pcmk__trim(char *str)
void crm_time_free_period(crm_time_period_t *period)
Free a dynamically allocated time period object.
#define crm_time_log_date