about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ebooks.cpp31
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;