The idiom is used quite early: Rudyard Kipling's A Conference of the Powers (1890):
"Following the first great law of the Army, which says ‘all property is common except money, and you’ve only got to ask the next man for that,’ The Infant offered tobacco and drink. It was the least he could do; but not the most lavish praise in the world held half as much appreciation and reverence as The Infant’s simple ‘Say when, sir,’ above the long glass.
Cleever said ‘when,’ and more thereto, for he was a golden talker, and he sat in the midst of hero-worship devoid of all taint of self-interest..."