Beispiel #1
0
		clock::clock( int days, int hours, int minutes, int seconds, int milliseconds ) {
			m_time = 0;
			add_days( days );
			add_hours( hours );
			add_min( minutes );
			add_s( seconds );
			add_ms( milliseconds );
		}
Beispiel #2
0
/* Event functions */
event_t *dummy_events(date_t start, date_t end)
{
	event_t *last = &event;
	for (int i = 0; i < 8; i++) {
		last->next        = new0(event_t);
		last->next->cal   = event.cal;
		last->next->start = event.start;
		last->next->end   = event.end;
		last->next->name  = strcopy(event.name);
		last->next->desc  = strcopy(event.desc);

		date_t *s = &last->next->start;
		date_t *e = &last->next->end;
		add_days(&s->year, &s->month, &s->day, 7*i);
		add_days(&e->year, &e->month, &e->day, 7*i);

		last = last->next;
		last->next = NULL;
	}
	return enable ? event.next : 0;
}
Beispiel #3
0
int main (int argc, char *argv[]) {

    struct tm t = {0};
    char * date = "20141124";
    char dt[9] = {0};
    datetotm (date, &t);
    puts("");
    strcpy(dt, date);
    add_days(date, 367, dt);
    puts(date);
    puts(dt);
    exit(0);
}
Beispiel #4
0
		void clock::add_month( CORE_MONTHS month ) {
			switch( month ) {
			case January:
			case March:
			case May:
			case July:
			case August:
			case October:
			case December:
				add_days( 31 );
				break;
			case February:
				add_days( 28 );
				break;
			case April:
			case June:
			case September:
			case November:
				add_days( 30 );
				break;
			}
		}
Beispiel #5
0
void
sub_days(ha_time_t * a_time, int extra)
{
    if (a_time->has->days == FALSE) {
        crm_trace("has->days == FALSE");
        return;
    }

    crm_trace("Subtracting %d days from %.4d-%.2d-%.2d",
              extra, a_time->years, a_time->months, a_time->days);

    if (extra < 0) {
        add_days(a_time, -extra);
    } else {
        do_sub_days_field(a_time, days, extra, sub_months);
    }

    convert_from_gregorian(a_time);
}
Beispiel #6
0
/* Month run */
int month_run(int key, mmask_t btn, int row, int col)
{
	int days = 0, months = 0;
	switch (key)
	{
		case 'h': days   = -1; break;
		case 'j': days   =  7; break;
		case 'k': days   = -7; break;
		case 'l': days   =  1; break;
		case 'i': months = -1; break;
		case 'o': months =  1; break;
	}
	if (days || months) {
		add_days(&SEL.year, &SEL.month, &SEL.day, days);
		add_months(&SEL.year, &SEL.month, months);
		werase(win);
		month_draw();
		wrefresh(win);
	}
	return days || months;
}
DateTime DateTime::end_of_day() const
{
    g_assert(is_set());

    return add_days(1).start_of_day().add_full(0,0,0,0,0,-1);
}