It is based on server time, but you can alter it in the admin section.
Add this line to the start of the code:
global $user_info, $modSettings;
$hour = date('G');
$time = time() + ($user_info['time_offset'] + $modSettings['time_offset']) * 3600;
$hour = date('G',$time);
This will take into account any adjustments you have made to the time, as well as adjustments that an individual has made through his/her profile.