I'm going to share the one I'm testing on my board now. (I was always getting good morning too with this one)
Mine is very simple code.
First, it gets the user's time.
Code:
$nghourdiff = $vbulletin->options['hourdiff'];
$ng_time = TIMENOW -$nghourdiff;
Then, it gets it as the hour in a 24 hour format
Code:
$ng_result = date('G',$ng_time);
Then, it goes on to figure out if this is morning, afternoon or night.
The product is attached.