When you speak about where and when, you are speaking about the setting of a piece of literature. We can talk about this as the "Setting of Time" and the "Setting of Place." Let's explore both here.
Setting of Time
Mark Twain wrote his novel The Adventures of Tom Sawyer in the late nineteenth century, but the actual setting of the novel is in the decade of the 1840s. We can be sure of this because slavery is most definitely still in force. Gender roles were very specific and the vernacular of Missouri is well-established in The Adventures of Tom Sawyer. Another aspect of the time is the use of superstition and, specifically, bad luck, that marks the mid nineteenth century.
Setting of Place
Although it is a purely fictional town, the town in The Adventures of Tom Sawyer is well-known to be modeled after Twain's own hometown in Missouri called Hannibal. Obviously, the Mississippi river plays a main role in the book and is even considered a character by some Twain scholars. In addition to vernacular being a good element of the setting of time, it can also be a good element in analyzing the setting of place in that the vernacular used in The Adventures of Tom Sawyer is most definitely from Hannibal, Missouri. The life in the fictional town centers upon life on and near the Mississippi River, so that aspect of the setting is distinct, albeit unnamed.
Just in case you'd like a primary source quote. Here is one that is full of both time AND place. Note the vernacular AND the mention of the river!
Like it! Yes—the way I'd like a hot stove if I was to set on it long enough. No, Tom, I won't be rich, and I won't live in them cussed smothery houses. I like the woods, and the river, and hogsheads, and I'll stick to 'em, too.