tmin = localtime((const char *)&mintime);
tmax = localtime((const char *)&maxtime);

これやったらtminとtmaxの中身が同じになってしまいました
なぜなんでしょう