The fact that you were "frightened" because you were 1 minute away from your NDL means that you were already diving beyond your limits.
While Lamont is certainly correct, the problem is amazingly common among divers. And by "the problem," I probably mean a couple of things.
Several years ago I was diving in the Galapagos with a buddy who was part of our group that made the trip together. I had never met him before the trip. He had logged hundreds of dives over a number of years of active diving in many places. During one dive while we were perhaps at 80 feet, he suddenly started heading hurriedly toward the surface. I followed, of course. When we were at about 25 feet I caught him and gave him a "What's up?" signal. With a look of near terror on his face, he showed me his computer (a Suunto). I stared at it for a while, seeing absolutely nothing problematic. I gave him a puzzled look and a "so what"" shrug. He almost shoved it in my face in response, and I returned the "I have no idea what the problem is" response, followed by a "can we get back to the dive?" gesture.
When we were back on the boat, he said excitedly, "I almost went into deco on that dive!" He explained that when he was at the depth at which he started his flight to the surface, he had seen that the computer was only giving him 3 minutes of no decompression diving, and he knew it would take him at least that long to get to the surface. When he showed me the computer in shallow water, he assumed I would see the NDL violation and be horrified. What I saw, of course, was that the computer had changed to giving him plenty of time due to his ascent. According to the computer, he still had quite a bit of pleasant diving time ahead of him.
I tried to explain it to him, but he would not listen. He just kept babbling--to everyone who would listen--about how he had narrowly missed going into deco.
I felt like slapping him across the face a few times to snap him out of it. I came close to that actually, although verbally.
Let me repeat what I said earlier. This man had logged hundreds of dives over a number of years. He had owned that computer for years.
Anyone who is that serious about diving needs to understand deco theory better than that, and if they are going to use a computer, they need to know how it works. I certainly hope all my newly minted OW students know more than that.