示例#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();
}
示例#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;
}
示例#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;
}
示例#4
0
文件: eztimer.cpp 项目: jj4jj/dcpots
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;
}
示例#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;
}
示例#6
0
void 
skynet_timer_init(void) {
	TI = timer_create_timer();
	TI->current = _gettime();
}
示例#7
0
文件: timers.c 项目: Stopka/StopWatch
Timer* timers_add_timer() {
	if(timers_count()>=TIMERS_MAX_COUNT){
		return NULL;
	}
	return timers_select(timers_add(timer_create_timer()));
}