예제 #1
0
파일: timer.c 프로젝트: 1060460048/tbox
/* //////////////////////////////////////////////////////////////////////////////////////
 * implementation
 */
static __tb_inline__ tb_hong_t tb_timer_now(tb_timer_impl_t* impl)
{
    // using the real time?
    if (!impl->ctime)
    {
        // get the time
        tb_timeval_t tv = {0};
        if (tb_gettimeofday(&tv, tb_null)) return ((tb_hong_t)tv.tv_sec * 1000 + tv.tv_usec / 1000);
    }

    // using cached time
    return tb_cache_time_mclock();
}
예제 #2
0
파일: time.c 프로젝트: siwuxian/xmake
tb_time_t tb_time()
{
    // time
    tb_timeval_t tv = {0};
    return tb_gettimeofday(&tv, tb_null)? tv.tv_sec : (tb_time_t)-1;
}