Beispiel #1
0
crm_time_t *
crm_time_new(const char *date_time)
{
    time_t tm_now;
    crm_time_t *dt = NULL;

    tzset();
    if (date_time == NULL) {
        tm_now = time(NULL);
        dt = calloc(1, sizeof(crm_time_t));
        crm_time_set_timet(dt, &tm_now);
    } else {
        dt = parse_date(date_time);
    }
    return dt;
}
Beispiel #2
0
static void
get_date(pe_working_set_t * data_set)
{
    int value = 0;
    time_t original_date = 0;

    crm_element_value_int(data_set->input, "execution-date", &value);
    original_date = value;

    if (use_date) {
        data_set->now = crm_time_new(use_date);

    } else if(original_date) {
        char *when = NULL;

        data_set->now = crm_time_new(NULL);
        crm_time_set_timet(data_set->now, &original_date);

        when = crm_time_as_string(data_set->now, crm_time_log_date|crm_time_log_timeofday);
        printf("Using the original execution date of: %s\n", when);

        free(when);
    }
}