|
Say you were using a C++ class like this: (The Logic::Time one) Logic::Time now = Logic::Time::Now(); Logic::Time then(1000); // 1000ms in the future std::cout << "Now: " << now.getMs() << std::endl; std::cout << "Until: " << then.getMs() << std::endl; for(int i = 0; i < 10000; i++) {
std::cout << then.getMs() << std::endl; sleep(1); }
and it output this: ( every line after the first two is output every second actually it clearly isn't) Now: 0 Until: 990 987 901 688 445 195 -59 -293 -459 -571 1) Is this what would you expect if you were using this object? What would your first opinion of it be? 2) If not, what would you call this? EDIT: I suppose changing the getMs() method to getMsDiff() or something would make it clearer. Though its not really a difference...
Last Edit: Feb 6, 2010 23:39:24 GMT by Simie
|
|
|
|
|
I'd want to know how 1000ms = 990ms! :/
|
|
|
|
It took 10ms to get to that point. (It is also likely that its being rounded) I noticed a huge bug with that, I was dividing and multiplying by 100 instead of 1000. Its pretty much sorted now, I only posted this because Tobias was complaining it made no sense =P What this was/is supposed to do: You create a time in the future Calling getMs() on it will get the ms since that time. If before, it will be negative Its for timing/scheduling things in a game we're making.
Last Edit: Feb 10, 2010 23:03:32 GMT by Simie
|
|
|
|
|
Fair enough. I'm still learing C++
|
|
|