currentTime and time are of UINT32 (unsigned int) type. If currentTime is 1 you will get very big positive number to compare with time variable. Plaese debug this case