1. 程式人生 > >YOLO原始碼(Darknet原始碼)解讀(utils.c)

YOLO原始碼(Darknet原始碼)解讀(utils.c)

utils.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <unistd.h>
#include <float.h>
#include <limits.h>
#include <time.h>
#include <sys/time.h>

#include "utils.h"

/*
timeval
{
    time_t tv_sec; //秒 [long int]
    suseconds_t tv_usec; //微秒 [long int]
};
*/
double what_time_is_it_now()
{
    struct timeval time;
    if (gettimeofday(&time,NULL)){
        return 0;
    }
    return (double)time.tv_sec + (double)time.tv_usec * .000001;
}