The original paper describing Patient HM is available online, and makes for fascinating reading: Scoville, W. B., Milner, B. 1957. Loss of
recent memory after bilateral hippocampal lesions. J Neurol Neurosurg Psychiatry. 1957 Feb; 20(1): 11–21. (Direct PDF)
From page 14:
This patient has even eaten luncheon in front of one of us (B.M.)
without being able to name, a mere half-hour later, a single item of
food he had eaten; in fact, he could not remember having eaten
luncheon at all. Yet to a casual observer this man seems like a
relatively normal individual, since his understanding and reasoning
are undiminished.
On page 15, the authors describe the group of subjects with "Severe Memory Defects", which included Patient HM:
In this category are those patients who since operation appear to
forget the incidents of their daily life as fast as they occur. It is
interesting that all these patients were able to retain a three-figure
number or a pair of unrelated words for several minutes, if care was
taken not to distract them in the interval. However, they forgot the
instant attention was diverted to a new topic.
There are plenty of other interesting aspects to this paper; I high recommend it. But I don't see any reference to the "thirty seconds" which @BenCole found in Wikipedia.
A followup paper on Patient HM — also well worth reading! — actually specifies that his memory can last indefinitely, yes, as long as he wasn't distracted. See Squire, Larry R. "The legacy of patient HM for neuroscience." Neuron 61.1 (2009): 6-9.
[…] H.M. had a remarkable capacity for sustained attention, including
the ability to retain information for a period of time after it was
presented. Thus, he could carry on a conversation, and he exhibited an
intact digit span (i.e., the ability to repeat back a string of six or
seven digits). Indeed, information remained available so long as it
could be actively maintained by rehearsal. For example, H.M. could
retain a three-digit number for as long as 15 min by continuous
rehearsal, organizing the digits according to an elaborate mnemonic
scheme. Yet when his attention was diverted to a new topic, he forgot
the whole event.
What I think we can infer is that there wasn't a theoretical limit for his attention, but the practical one was pretty severe. I don't recall specific details of how long the "period of time" was, or even how or whether it was explicitly tested, but since he undoubtedly couldn't remember that it was crucial for him to remain attentive, it would have been more of a test of the researchers' ability to keep him away from distraction, not of his own competence.
A more complete history of Patient HM is available at Dossani, et al. "The legacy of Henry Molaison (1926–2008) and the impact of his bilateral mesial temporal lobe surgery on the study of human memory." World Neurosurgery 84.4 (2015): 1127-1135., but I'm afraid it isn't open access, so you'll need institutional access to ScienceDirect Journals. I found this detail quite impressive:
Gabrieli et al. tested Molaison on several aspects of semantic memory,
including understanding of the meaning, perception, and pronunciation
of words, and showed that semantic memory acquired before the
operation was normal compared with that encountered postoperatively.
Molaison's inability to collect new semantic information did not
affect his ability to carry normal conversations using the words he
knew preoperatively. Molaison continued to have a sense of humor and
understood complex sentences with ambiguous syntax. Longitudinal
studies conducted over a period of 48 years showed consistency in
scores obtained on four Wechsler subtests (Information,
Comprehension, Similarities, and Vocabulary).
But if you don't have access to that, here are links to three other public bios, found via an image search of Patient HM found in the above article: