Question: assume the file that rule refers to has never been compiled. But the function keeps returning 0 when I run it. What could be causing the problem?

int compare_time(Rule *rule) {
    struct stat target_stat;

    Dependency *dep_cur = rule->dependencies;

    if (stat(rule->target, &target_stat) < 0) {
        // target file was never executed, so need to run actions
        return 1;
    }
    while (dep_cur != NULL) {
        struct stat check_stat;
        stat(dep_cur->rule->target, &check_stat);           // set up struct for dependency
        struct timespec target_time = target_stat.st_mtim;  // get last modified time from target
        struct timespec dep_time = check_stat.st_mtim;
        if (dep_time.tv_sec > target_time.tv_sec || dep_time.tv_nsec > target_time.tv_nsec) {
            // dependency is more up to date, need to execute actions
            return 1;
        }
        dep_cur = dep_cur->next_dep;
    }
    return 0;
}