Time travel and grandfather clock put me in mind of Philippa Pearce's Tom's Midnight Garden. It fits most elements of your story except the parts about the teacher and the basement. See the Wikipedia description (emphasis mine, less relevant parts removed):
Tom is sent to stay with his Uncle Alan and Aunt Gwen. They live in an upstairs flat of a big house with no garden, only a tiny yard for parking. The elderly and reclusive landlady, Mrs Bartholomew, lives above them. Without exercise he lies awake after midnight, restless, when he hears the communal grandfather clock strangely strike 13. He gets up to investigate and discovers that the back door now opens on a large sunlit garden.
Every night the clock strikes 13 and Tom returns to the Victorian era grounds. There he meets another lonely child, a girl called Hatty, and they become inseparable playmates. Gradually at first, Hatty grows up and passes Tom's age; he comes to realise that he is slipping to different points in the past.
On the final night before Tom is due to go home, he goes downstairs to find the garden is not there. He desperately tries to run around and find it, but crashes into a set of bins from the present day courtyard, waking up several residents. The following morning, Mrs Bartholomew summons Tom to apologise, only to reveal herself as Hatty, having made the link when she heard him call her name. The events Tom experienced were real in Hatty's past; he has stepped into them by going into the garden at the times she dreamt of them.
Hatty / Mrs Bartholomew, as an old lady, may possibly be the 'teacher' you're thinking of, while the gloomy courtyard that's outside the back door in the present day may be the 'basement'. Or maybe you're confusing two books together in your head. Or I may be completely wrong!
A longer shot is the book-within-a book, the
Fillory and Further series by the fictitious Christopher Plover, found in Lev Grossman's
The Magicians (in which some kids discover that the fantasy world in their favourite novels is in fact real). Quoting directly from
The Magicians itself:
In the foreground, every summer for three years, the children leave their various boarding schools and return to Cornwall, and each time they find their way into the secret world of Fillory, where they have adventrues and explore magical lands and defend the gentle creatures who live there against the various forces that menace them.
But there was a more seductive, more dangerous truth to Fillory that Quentin couldn't let go. It was almost like the Fillory books - especially the first one, The World in the Walls - were about reading itself. When the oldest Chatwin, melancholy Martin, opens the cabinet of the grandfather clock that stands in a dark, narrow back hallway in his aunt's house and slips through into Fillory