pacemaker
2.1.9-49aab99839
Scalable High-Availability cluster resource manager
|
#include <crm_internal.h>
#include <crm/crm.h>
#include <time.h>
#include <ctype.h>
#include <inttypes.h>
#include <limits.h>
#include <string.h>
#include <stdbool.h>
#include <crm/common/iso8601.h>
#include <crm/common/iso8601_internal.h>
#include "crmcommon_private.h"
Go to the source code of this file.
Macros | |
#define | GMTOFF(tm) (-timezone+daylight) |
#define | HOUR_SECONDS (60 * 60) |
#define | DAY_SECONDS (HOUR_SECONDS * 24) |
#define | valid_sec_usec(sec, usec) |
#define | EPOCH_SECONDS 62135596800ULL /* Calculated using crm_time_get_seconds() */ |
#define | DATE_MAX 128 |
#define | do_cmp_field(l, r, field) |
#define | ydays(t) (crm_time_leapyear((t)->years)? 366 : 365) |
#define | MS_IN_S (1000) |
#define | MS_IN_M (MS_IN_S * 60) |
#define | MS_IN_H (MS_IN_M * 60) |
#define | MS_IN_D (MS_IN_H * 24) |
#define | MAXSTR sizeof("..d..h..m..s...ms") |
Typedefs | |
typedef void(* | component_fn_t) (crm_time_t *, int) |
Functions | |
crm_time_t * | crm_time_new (const char *date_time) |
crm_time_t * | crm_time_new_undefined (void) |
Allocate memory for an uninitialized time object. More... | |
bool | crm_time_is_defined (const crm_time_t *t) |
Check whether a time object has been initialized yet. More... | |
void | crm_time_free (crm_time_t *dt) |
int | crm_time_january1_weekday (int year) |
int | crm_time_weeks_in_year (int year) |
int | crm_time_days_in_month (int month, int year) |
Return number of days in given month of given year. More... | |
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) |
int | crm_time_get_timeofday (const crm_time_t *dt, uint32_t *h, uint32_t *m, uint32_t *s) |
int | crm_time_get_timezone (const crm_time_t *dt, uint32_t *h, uint32_t *m) |
long long | crm_time_get_seconds (const crm_time_t *dt) |
long long | crm_time_get_seconds_since_epoch (const crm_time_t *dt) |
int | crm_time_get_gregorian (const crm_time_t *dt, uint32_t *y, uint32_t *m, uint32_t *d) |
int | crm_time_get_ordinal (const crm_time_t *dt, uint32_t *y, uint32_t *d) |
int | crm_time_get_isoweek (const crm_time_t *dt, uint32_t *y, uint32_t *w, uint32_t *d) |
char * | crm_time_as_string (const crm_time_t *dt, int flags) |
Get a string representation of a crm_time_t object. More... | |
crm_time_t * | crm_time_parse_duration (const char *period_s) |
Parse a time duration from an ISO 8601 duration specification. More... | |
crm_time_period_t * | crm_time_parse_period (const char *period_str) |
Parse a time period from an ISO 8601 interval specification. More... | |
void | crm_time_free_period (crm_time_period_t *period) |
Free a dynamically allocated time period object. More... | |
void | crm_time_set (crm_time_t *target, const crm_time_t *source) |
void | crm_time_set_timet (crm_time_t *target, const time_t *source) |
void | pcmk__set_time_if_earlier (crm_time_t *target, const crm_time_t *source) |
crm_time_t * | pcmk_copy_time (const crm_time_t *source) |
crm_time_t * | pcmk__copy_timet (time_t source) |
crm_time_t * | crm_time_add (const crm_time_t *dt, const crm_time_t *value) |
const char * | pcmk__time_component_attr (enum pcmk__time_component component) |
int | pcmk__add_time_from_xml (crm_time_t *t, enum pcmk__time_component component, const xmlNode *xml) |
crm_time_t * | crm_time_calculate_duration (const crm_time_t *dt, const crm_time_t *value) |
crm_time_t * | crm_time_subtract (const crm_time_t *dt, const crm_time_t *value) |
bool | crm_time_check (const crm_time_t *dt) |
Check whether a time object represents a sensible date/time. More... | |
int | crm_time_compare (const crm_time_t *a, const crm_time_t *b) |
void | crm_time_add_seconds (crm_time_t *a_time, int extra) |
Add a given number of seconds to a date/time or duration. More... | |
void | crm_time_add_days (crm_time_t *a_time, int extra) |
Add days to a date/time. More... | |
void | crm_time_add_months (crm_time_t *a_time, int extra) |
void | crm_time_add_minutes (crm_time_t *a_time, int extra) |
void | crm_time_add_hours (crm_time_t *a_time, int extra) |
void | crm_time_add_weeks (crm_time_t *a_time, int extra) |
void | crm_time_add_years (crm_time_t *a_time, int extra) |
pcmk__time_hr_t * | pcmk__time_hr_convert (pcmk__time_hr_t *target, const crm_time_t *dt) |
void | pcmk__time_set_hr_dt (crm_time_t *target, const pcmk__time_hr_t *hr_dt) |
pcmk__time_hr_t * | pcmk__time_hr_now (time_t *epoch) |
pcmk__time_hr_t * | pcmk__time_hr_new (const char *date_time) |
void | pcmk__time_hr_free (pcmk__time_hr_t *hr_dt) |
char * | pcmk__time_format_hr (const char *format, const pcmk__time_hr_t *hr_dt) |
char * | pcmk__epoch2str (const time_t *source, uint32_t flags) |
char * | pcmk__timespec2str (const struct timespec *ts, uint32_t flags) |
const char * | pcmk__readable_interval (guint interval_ms) |
#define DAY_SECONDS (HOUR_SECONDS * 24) |
#define do_cmp_field | ( | l, | |
r, | |||
field | |||
) |
#define EPOCH_SECONDS 62135596800ULL /* Calculated using crm_time_get_seconds() */ |
#define MAXSTR sizeof("..d..h..m..s...ms") |
#define MS_IN_D (MS_IN_H * 24) |
#define MS_IN_H (MS_IN_M * 60) |
#define MS_IN_M (MS_IN_S * 60) |
#define MS_IN_S (1000) |
#define valid_sec_usec | ( | sec, | |
usec | |||
) |
#define ydays | ( | t | ) | (crm_time_leapyear((t)->years)? 366 : 365) |
typedef void(* component_fn_t) (crm_time_t *, int) |
crm_time_t* crm_time_add | ( | const crm_time_t * | dt, |
const crm_time_t * | value | ||
) |
void crm_time_add_days | ( | crm_time_t * | a_time, |
int | extra | ||
) |
void crm_time_add_hours | ( | crm_time_t * | a_time, |
int | extra | ||
) |
void crm_time_add_minutes | ( | crm_time_t * | a_time, |
int | extra | ||
) |
void crm_time_add_months | ( | crm_time_t * | a_time, |
int | extra | ||
) |
void crm_time_add_seconds | ( | crm_time_t * | a_time, |
int | extra | ||
) |
void crm_time_add_weeks | ( | crm_time_t * | a_time, |
int | extra | ||
) |
void crm_time_add_years | ( | crm_time_t * | a_time, |
int | extra | ||
) |
char* crm_time_as_string | ( | const crm_time_t * | dt, |
int | flags | ||
) |
crm_time_t* crm_time_calculate_duration | ( | const crm_time_t * | dt, |
const crm_time_t * | value | ||
) |
bool crm_time_check | ( | const crm_time_t * | dt | ) |
int crm_time_compare | ( | const crm_time_t * | a, |
const crm_time_t * | b | ||
) |
int crm_time_days_in_month | ( | int | month, |
int | year | ||
) |
void crm_time_free | ( | crm_time_t * | dt | ) |
void crm_time_free_period | ( | crm_time_period_t * | period | ) |
int crm_time_get_gregorian | ( | const crm_time_t * | dt, |
uint32_t * | y, | ||
uint32_t * | m, | ||
uint32_t * | d | ||
) |
int crm_time_get_isoweek | ( | const crm_time_t * | dt, |
uint32_t * | y, | ||
uint32_t * | w, | ||
uint32_t * | d | ||
) |
int crm_time_get_ordinal | ( | const crm_time_t * | dt, |
uint32_t * | y, | ||
uint32_t * | d | ||
) |
long long crm_time_get_seconds | ( | const crm_time_t * | dt | ) |
long long crm_time_get_seconds_since_epoch | ( | const crm_time_t * | dt | ) |
int crm_time_get_timeofday | ( | const crm_time_t * | dt, |
uint32_t * | h, | ||
uint32_t * | m, | ||
uint32_t * | s | ||
) |
int crm_time_get_timezone | ( | const crm_time_t * | dt, |
uint32_t * | h, | ||
uint32_t * | m | ||
) |
bool crm_time_is_defined | ( | const crm_time_t * | t | ) |
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 | ||
) |
crm_time_t* crm_time_new | ( | const char * | date_time | ) |
crm_time_t* crm_time_new_undefined | ( | void | ) |
Allocate memory for an uninitialized time object.
crm_time_t* crm_time_parse_duration | ( | const char * | period_s | ) |
Parse a time duration from an ISO 8601 duration specification.
[in] | period_s | ISO 8601 duration specification (optionally followed by whitespace, after which the rest of the string will be ignored) |
crm_time_period_t* crm_time_parse_period | ( | const char * | period_str | ) |
Parse a time period from an ISO 8601 interval specification.
[in] | period_str | ISO 8601 interval specification (start/end, start/duration, or duration/end) |
void crm_time_set | ( | crm_time_t * | target, |
const crm_time_t * | source | ||
) |
void crm_time_set_timet | ( | crm_time_t * | target, |
const time_t * | source | ||
) |
crm_time_t* crm_time_subtract | ( | const crm_time_t * | dt, |
const crm_time_t * | value | ||
) |
int pcmk__add_time_from_xml | ( | crm_time_t * | t, |
enum pcmk__time_component | component, | ||
const xmlNode * | xml | ||
) |
crm_time_t* pcmk__copy_timet | ( | time_t | source | ) |
char* pcmk__epoch2str | ( | const time_t * | source, |
uint32_t | flags | ||
) |
void pcmk__set_time_if_earlier | ( | crm_time_t * | target, |
const crm_time_t * | source | ||
) |
const char* pcmk__time_component_attr | ( | enum pcmk__time_component | component | ) |
char* pcmk__time_format_hr | ( | const char * | format, |
const pcmk__time_hr_t * | hr_dt | ||
) |
pcmk__time_hr_t* pcmk__time_hr_convert | ( | pcmk__time_hr_t * | target, |
const crm_time_t * | dt | ||
) |
void pcmk__time_hr_free | ( | pcmk__time_hr_t * | hr_dt | ) |
pcmk__time_hr_t* pcmk__time_hr_new | ( | const char * | date_time | ) |
pcmk__time_hr_t* pcmk__time_hr_now | ( | time_t * | epoch | ) |
void pcmk__time_set_hr_dt | ( | crm_time_t * | target, |
const pcmk__time_hr_t * | hr_dt | ||
) |
char* pcmk__timespec2str | ( | const struct timespec * | ts, |
uint32_t | flags | ||
) |
crm_time_t* pcmk_copy_time | ( | const crm_time_t * | source | ) |