dimanche 18 février 2018

why isn't my if-statement working?

I am trying to create a timer in this program, using a for loop. My logic is to display the time when the time difference 1 second or more. But the if statement does not seem to work!

#include<time.h>
int main()
{
  struct tm *local;
  time_t t,t1,t2;
  float tdiff;
  long int i,j;
  t = time (NULL);

    for (j==0; j<100000; j++){
        t2 =time(NULL);
        tdiff = difftime(t2,t);
        if (tdiff != 0.00000){
            printf("%f\n",tdiff);
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire