Example #1
0
/* 初始化定时器模块, 初始工作包括构建定时器对象, 初始化时间系统的当前时间、启动时间、
 * 启动时间戳和当前时间戳. */
void 
skynet_timer_init(void) {
	TI = timer_create_timer();
	uint32_t current = 0;
	systime(&TI->starttime, &current);
	TI->current = current;
	TI->current_point = gettime();
}
Example #2
0
void 
skynet_timer_init(void) {
	TI = timer_create_timer();
	systime(&TI->starttime, &TI->current);
	uint64_t point = gettime();
	TI->current_point = point;
	TI->origin_point = point;
}
Example #3
0
void 
skynet_timer_init(void) {
	TI = timer_create_timer();
	TI->current = _gettime();

	struct timespec ti;
	clock_gettime(CLOCK_REALTIME, &ti);
	uint32_t sec = (uint32_t)ti.tv_sec;
	uint32_t mono = _gettime() / 100;

	TI->starttime = sec - mono;
}
Example #4
0
int eztimer_init(void) {
    if(TI)
    {
        return E_EZTMR_ALRADY_INITED;
    }
	TI = timer_create_timer();
	systime(&TI->starttime, &TI->current);
	uint64_t point = gettime();
	TI->current_point = point;
	TI->origin_point = point;
    TI->dispather = NULL;
    return 0;
}
Example #5
0
void
skynet_timer_init(void) {
    TI = timer_create_timer();
    TI->current = _gettime();

#if defined(_POSIX_TIMERS)
    struct timespec ti;
    clock_gettime(CLOCK_REALTIME, &ti);
    uint32_t sec = (uint32_t)ti.tv_sec;
#else
    struct timeval tv;
    gettimeofday(&tv, NULL);
    uint32_t sec = (uint32_t)tv.tv_sec;
#endif
    uint32_t mono = _gettime() / 100;

    TI->starttime = sec - mono;
}
Example #6
0
void 
skynet_timer_init(void) {
	TI = timer_create_timer();
	TI->current = _gettime();
}
Example #7
0
Timer* timers_add_timer() {
	if(timers_count()>=TIMERS_MAX_COUNT){
		return NULL;
	}
	return timers_select(timers_add(timer_create_timer()));
}