From a791091a4da2335ee45f3716cfe68466e5ebd679 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 28 Feb 2016 18:39:41 -0500 Subject: rawr-ebooks now tells you how long it will wait before the next tweet --- ebooks.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'ebooks.cpp') diff --git a/ebooks.cpp b/ebooks.cpp index 18a0a79..7d2724c 100644 --- a/ebooks.cpp +++ b/ebooks.cpp @@ -56,8 +56,37 @@ int main(int argc, char** args) twitter.getLastCurlError(replyMsg); std::cout << "Curl error: " << replyMsg << std::endl; } + + int waitlen = rand() % delay; + if (waitlen == 0) + { + continue; + } else if (waitlen == 1) + { + std::cout << "Sleeping for 1 second..." << std::endl; + } else if (waitlen < 60) + { + std::cout << "Sleeping for " << waitlen << " seconds..." << std::endl; + } else if (waitlen == 60) + { + std::cout << "Sleeping for 1 minute..." << std::endl; + } else if (waitlen < 60*60) + { + std::cout << "Sleeping for " << (waitlen/60) << " minutes..." << std::endl; + } else if (waitlen == 60*60) + { + std::cout << "Sleeping for 1 hour..." << std::endl; + } else if (waitlen < 60*60*24) + { + std::cout << "Sleeping for " << (waitlen/60/60) << " hours..." << std::endl; + } else if (waitlen == 60*60*24) + { + std::cout << "Sleeping for 1 day..." << std::endl; + } else { + std::cout << "Sleeping for " << (waitlen/60/60/24) << " days..." << std::endl; + } - sleep(rand() % delay); + sleep(waitlen); } return 0; -- cgit 1.4.1