diff options
| author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-28 18:39:41 -0500 |
|---|---|---|
| committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-28 18:39:41 -0500 |
| commit | a791091a4da2335ee45f3716cfe68466e5ebd679 (patch) | |
| tree | 1df9b1f1f8b87fc75e5f6296b9129a3ba88151c6 | |
| parent | a1265a74c94d678405a561a2fb21dd2b8025d31c (diff) | |
| download | rawr-ebooks-a791091a4da2335ee45f3716cfe68466e5ebd679.tar.gz rawr-ebooks-a791091a4da2335ee45f3716cfe68466e5ebd679.tar.bz2 rawr-ebooks-a791091a4da2335ee45f3716cfe68466e5ebd679.zip | |
rawr-ebooks now tells you how long it will wait before the next tweet
| -rw-r--r-- | ebooks.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
| 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) | |||
| 56 | twitter.getLastCurlError(replyMsg); | 56 | twitter.getLastCurlError(replyMsg); |
| 57 | std::cout << "Curl error: " << replyMsg << std::endl; | 57 | std::cout << "Curl error: " << replyMsg << std::endl; |
| 58 | } | 58 | } |
| 59 | |||
| 60 | int waitlen = rand() % delay; | ||
| 61 | if (waitlen == 0) | ||
| 62 | { | ||
| 63 | continue; | ||
| 64 | } else if (waitlen == 1) | ||
| 65 | { | ||
| 66 | std::cout << "Sleeping for 1 second..." << std::endl; | ||
| 67 | } else if (waitlen < 60) | ||
| 68 | { | ||
| 69 | std::cout << "Sleeping for " << waitlen << " seconds..." << std::endl; | ||
| 70 | } else if (waitlen == 60) | ||
| 71 | { | ||
| 72 | std::cout << "Sleeping for 1 minute..." << std::endl; | ||
| 73 | } else if (waitlen < 60*60) | ||
| 74 | { | ||
| 75 | std::cout << "Sleeping for " << (waitlen/60) << " minutes..." << std::endl; | ||
| 76 | } else if (waitlen == 60*60) | ||
| 77 | { | ||
| 78 | std::cout << "Sleeping for 1 hour..." << std::endl; | ||
| 79 | } else if (waitlen < 60*60*24) | ||
| 80 | { | ||
| 81 | std::cout << "Sleeping for " << (waitlen/60/60) << " hours..." << std::endl; | ||
| 82 | } else if (waitlen == 60*60*24) | ||
| 83 | { | ||
| 84 | std::cout << "Sleeping for 1 day..." << std::endl; | ||
| 85 | } else { | ||
| 86 | std::cout << "Sleeping for " << (waitlen/60/60/24) << " days..." << std::endl; | ||
| 87 | } | ||
| 59 | 88 | ||
| 60 | sleep(rand() % delay); | 89 | sleep(waitlen); |
| 61 | } | 90 | } |
| 62 | 91 | ||
| 63 | return 0; | 92 | return 0; |
