Function to get minute?

Started by Rocky, Apr 16, 2015, 06:20 AM

Previous topic - Next topic

Rocky

I'm trying to set real life time in the game world. (not completely accurate through).
function SetWorldTime()
{
   SetTimeRate( 60000 );
   SetTime( date()["hour"], date()["minute"] );
}

I've set my time rate at 60000 (60 secs) so the time changes like in real life. Problem is minute doesn't exist in date() only hour does. I've used GetFullTime() and splitted it to get minute and hour out of it.

function getTimefromFunc( hour )
{
   local text = GetFullTime(), time = split( text, "," )[ 3 ], time_table = split(time,":");
   if( hour == true ) return time_table[0]; //returns hour
   else return time_table[1]; //returns minute
}

It works fine but i keep getting this "GetFullTime is depreciated and may be removed in the future." on console each time i use this function. So, is there any alternative function which allow me to get minute?

Gudio

#1
date().hour, date().min
_/

Rocky

Thanks gudio, never knew date() could be used like that. :)