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
           glutTimerFunc(1, weaponController, 1);
void specialkey(unsigned char key, int x, int y) 
    case 't':
    stopRotation = true;

    case 'T':
    stopRotation = false;

How can I do that? Thanks for any helping!