Help Me Identify This Post-Modernist Novel

It is 2:00 a.m. and I cannot sleep…

The book was picaresque, the lifetime adventures of a rogue. As a young man, he was a highwayman, robbing stage coaches.

Later, he lived for a while in a city which was inside a large cube of ice. The ice was melting, so water was always falling. The clocks were all rusting, so one never knew the proper time. The citizens of the city spent a lot of time in odd, pointless conspiracies.

As an old man, the protagonist is riding in a stage coach when it is robbed by a highwayman. I thought it might have been clever if the robber had been himself as a young man, but this was not to be.

The writer apparently wrote other books set in the city inside the block of ice.

Does any of this ring any bells at all?

I sleep now.