void measure_time(poly_func_t poly, const double a[], double x, long degree,
                  double *time) {
    struct timespec start, end;
    double result;

    poly(a, x, degree, &result); // warm up

    clock_gettime(CLOCK_MONOTONIC, &start); // startTime of func_Ploy()
    poly(a, x, degree, &result);
    clock_gettime(CLOCK_MONOTONIC, &end); // endTime of func_Ploy()

    *time = (end.tv_sec - start.tv_sec) * 1e9; // get dertaTime in s-level and transvert to ns-level
    *time += (end.tv_nsec - start.tv_nsec);    // get dertaTime in ns-level
    
    /*
    supplementary:

        struct timespec {
            time_t tv_sec; // seconds
            long tv_nsec; // nanoseconds
        };
    */
}
