“Time is quixotic because it can torment us. When we have insufficient stimulus to fill our lives, we resent the relentless quality of time, and we engage in activities designed to “kill time.” Time that passes slowly creates insufferable boredom; time that passes to quickly makes us aware of our accelerated death march. A person’s perspective on time depends mostly on what they are most afraid of, boredom or death.”
Boredom is a condition characterized by perception of one's environment as dull, tedious, and lacking in stimulation. This can result from leisure and a lack of aesthetic interests. Labor and art may be alienated and passive, or immersed in tedium. There is an inherent anxiety in boredom; people will expend considerable effort to prevent or remedy it, yet in many circumstances, it is accepted as suffering to be endured. Common passive ways to escape boredom are to sleep or to think creative thoughts (daydream). Typical active solutions consist in an intentional activity of some sort, often something new, as familiarity and repetition lead to the tedious.
The authors of this paper point to an interesting study by Robin Damrad-Frye and James Laird in the August 1989 issue of the Journal of Personality and Social Psychology. In this study, participants had to listen to a tape of a person reading a Psychology Today article. In the next room, there was a television soundtrack from a soap opera playing. For some groups listening to the article, the TV was very loud and distracting, for others it was barely noticeable, and for some it was not playing at all. After listening to the article, people rated their boredom during the study. 
Acceptance Affection Amusement Anger Angst Anguish Annoyance Anticipation Anxiety Apathy Arousal Awe Boredom Confidence Contempt Contentment Courage Cruelty Curiosity Depression Desire Despair Disappointment Disgust Distrust Ecstasy Embarrassment Empathy Enthusiasm Envy Euphoria Fear Frustration Gratification Gratitude Greed Grief Guilt Happiness Hatred Hope Horror Hostility Humiliation Interest Jealousy Joy Kindness Loneliness Love Lust Outrage Panic Passion Pity Pleasure Pride Rage Regret Rejection Remorse Resentment Sadness Saudade Schadenfreude Self-confidence Self-pity Shame Shock Shyness Social connection Sorrow Suffering Surprise Trust Wonder Worry

The people who heard the barely noticeable TV rated themselves as more bored than either the ones who heard the loud TV or heard no soundtrack. The idea is that both the loud TV and the soft TV were distracting, but for those who heard the loud TV it was clear why they were distracted from the article. Thus, they may have been frustrated with the noise, but they were not bored. Those who heard the soft soundtrack had difficulty concentrating, but they were not sure why, and so they attributed the difficulty concentrating to boredom.

What can you do about boredom? Obviously, there are times when you are stuck. If you are listening to a lecture that you cannot leave, then you just need to find a way to get through it. When you have some control, though, use your understanding of boredom to help you out. If you can, try to do a meditation exercise to lower your arousal level. Also, keep some music handy. Music you enjoy can crowd out distractions in the environment. It can also influence your mood in positive ways to counteract the pain of being bored.  
Boredom also has its benefits. It is important to see boredom as a “call to action” (Svendsen, 1999). Nietzsche suggested that men of rare sensibility value boredom as an impetus to achievement. Boredom can be a catalyst for action. It can provide an opportunity for thought and reflection. It can also be a sign that a task is a waste of time—and thus not worth continuing.

When the antiproton was discovered … it sent a wave of ennui through the physics community. Not that its discovery was unimportant, but on the basis of Dirac's theory, everybody expected it. — Roger G. Newton, The Truth of Science, 1997 Chauncey and I were keen enough about our aesthetic solution to the ennui of war to try to proselytize others. He organized discussion groups with the crew; I took volunteers to visit landmarks … — Louis Auchincloss, "Atlantic War," in Authors at Sea, ed. Robert Shenk,  1997 The attendant outside was standing on tennis balls, exercising the soles of her feet, her body swaying back and forth with the ennui of jelly. — Edna O'Brien, New Yorker, 17 June 1991 Thus the days of life are consumed, one by one, without an object beyond the present moment; ever flying from the ennui of that, yet carrying it with us … — Thomas Jefferson, in a letter dated 7 Feb. 1787 Thomas Jefferson: Writings,  1984 the kind of ennui that comes from having too much time on one's hands and too little will to find something productive to do