Reputation: 9643
Well i want to manipulate time with a time_t variable in this way:
I don't want to use boost because i don't want to link my application to it. I hope i made it clear that i want to check what's the time now and what it would be in say 10:00 to get the time difference between now and a pre defined time (not date).
Upvotes: 0
Views: 1088
Reputation: 103515
time_t time1;
time(&time1);
tm time0 = *localtime( &time1);
if (time0.tm_hour == 22 && time0.tm_min == 0)
; // it 10PM
else
{
// force time0 to 10PM
time0.tm_hour = 22;
time0.tm_min = 0;
time_t time2 = mktime(&time0);
}
Upvotes: 1
Reputation: 57774
Either use GetSystemTime() so everything is Windows, or call time() to get the current time using the C runtime values.
Upvotes: 0