How to rotate an object in certain range in OpenGL?

I have built a hammer, and I want to rotate the hammer quickly to strike a blow when I press a specific keyboard.

I have used a timer function to achieve this. Right now my hammer can rotate 360 degrees when I press a specific keyboard, my goal is to rotate the hammer between 90 and -90 degrees.

My code:

bool stopRotation = false;
void weaponController(int val) 
{
    if (stopRotation != false) {
           zr++;   //the default angle is 0
           glutPostRedisplay();
           glutTimerFunc(1, weaponController, 1);
    } 
}
void specialkey(unsigned char key, int x, int y) 
{ 
    case 't':
    stopRotation = true;
    glutTimerFunc(10,weaponController,0);
    break;

    case 'T':
    stopRotation = false;
    break;
}

How can I do that? Thanks for any helping!