The story centers on Arksenty Ivanovich Poprishchin, a low-ranking civil servant (titular counsellor), constantly belittled and criticized for underachieving. He yearns to be noticed by a beautiful woman, Sophie, the daughter of his boss, with whom he has fallen in love. As he said in his first sight of her, just after being a beast of a civil servant himself, “A footman opened the carriage door and out she fluttered, just like a little bird.” Nothing comes of this love he feels for her; Sophie is effectively unaware of him.
His diary records his gradual slide into insanity. As his madness deepens, he begins to "understand" the conversations of two dogs and believes he has discovered letters sent between them. The style of the letters, including what Poprishchin terms “dogginess” and “canine nature”, convince him of the letters' authenticity. The letters provide Poprishchin with a much more in-depth view of Sophie’s life, including her engagement to another man.
In “The Year 2000, 43rd of April”, it is made clear that Poprishchin has now gone mad. This diary entry is the first of many which he has lost the ability to distinguish a true sense of time. He begins to believe himself to be the heir to the throne of Spain. He decides to make a Spanish royal uniform so that the common people will recognize him. Believing himself in Spain, waiting for the Spanish deputies to arrive, he then decides that he is in fact in China. This trip is actually an appearance of his imagination that has been translated from being maltreated in an insane asylum.

Question: When does Poprishchin decide he is in China?
Answer: while he's waiting for Spanish deputies to arrive
Alternative answer: While waiting for Spanish deputies.