Page 1 of 1

How to get system time?

Posted: Tue Jul 08, 2014 8:17 pm
by Gnasty Gnork
Im trying to use:

Code: Select all

ITimer *real_time;
 
 
 
u32 system_hour = real_time->getRealTimeAndDate().Hour;

But this doesnt seem to work (compile errors). Is there a better/proper way to get system hour? Please help

Here is the error that i get, relative to real_time;
__vfptr CXX0030: Errore: impossibile valutare l'espressione

That means "Impossible to evaluate expression" or something like that.

Re: How to get system time?

Posted: Tue Jul 08, 2014 10:18 pm
by CuteAlien
You have to get the timer from the IrrlichtDevice, in your case you only have an uninitialized pointer. But that's not the problem you have (you would notice that at runtime not compile-time). Not exactly sure about your errror - it also doesn't look complete. Is this really the whole error? (Please never try to shorten compiler errors, they are already as short as they can be without throwing out information others need to help you - just copy paste them full when asking for help)

Re: How to get system time?

Posted: Wed Jul 09, 2014 12:12 pm
by Gnasty Gnork
Yeah sorry im just dumb... Thank you for helping me opening my eyes.

Here is how it works (if somebody needs it):

Code: Select all

    ITimer *real_time = device->getTimer();
 
 
u32 system_hour = real_time->getRealTimeAndDate().Hour; 
Btw the full error was:

Image

Re: How to get system time?

Posted: Thu Jul 10, 2014 1:02 pm
by hybrid
Yeah, so first line (even no error here) indicates quite obviously that you access an uninitialized NULL pointer. Which you should never do.