The Fourth Doctor knew his time was running short when he spotted the Watcher during the serial Logopolis. While he did not directly hint (until the very end) that he knew the Watcher's purpose, it is inferred that he knew exactly that his time was coming to an end, which is why "the moment had been prepared for".