EDIT: Works just fine, I messed up in another place of my code.
I am trying to increase an Integer once every minute, using C++11 chrono library. For some reasons, the comparison does not work as it should: It just returns true every time. Is something wrong with the cast to seconds? Shouldn't the result be an int, containing the difference of both time points in seconds?
Would really appreciate your help! Here's the Code:
std::chrono::time_point<std::chrono::system_clock> starttime = std::chrono::system_clock::now();
int timeLine = 0;
int main() {
while (true) {
std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
int seconds = timeLine * 60;
if ((std::chrono::duration_cast<std::chrono::seconds>(starttime - now)).count() + seconds <= 0) {
timeLine++;
nextConstellation();
cout << "Timeline: " << timeLine << endl;
}
}
}