answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Joshua took a nap sorting the mail?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Sample code of c plus plus by using delay?

Unfortunately, there is no cross-platform method of forcing a delay. Microsoft uses the sleep function (with a 1 second resolution) while UNIX uses usleep (with 1 nanosecond resolution). However, neither method can be regarded as being accurate in a multi-processing environment -- both will sleep for "at least" the given time, but if the system is busy your application will continue to sleep until its next time-slice comes around. Although usleep has a resolution of 1 nanosecond (1 billionth of a second), the system's frequency determines the actual resolution. For instance if your system has a frequency of 25 million ticks per second, your resolution is only 25 microseconds, so you cannot sleep for any less than that. Plus you have to add on the time it takes to make the call. C++11 provides much better support for hi-resolution timers in the <chrono> header, so at least we now have a portable method of sleeping for a preset duration. However the duration is still "at least" -- background tasks can still prevent your program from waking up on time. The following example demonstrates how to print the current time and how to put your program to sleep for a duration. Note that we still have no portable method of obtaining the current time in a thread-safe manner -- but the code includes a portable workaround. #include<iostream> // std::cout, std::endl #include<iomanip> // std::put_time #include<sstream> // std::stringstream #include<chrono> // std::chrono (C++11) #include<thread> // std::this_thread (C++11) namespace my_std { // std::localtime is not thread-safe but there is // no portable alternative in the standard. Thus // we must define our own standards... tm localtime (const std::time_t& time) { std::tm snapshot; #if (defined (WIN32) defined (_WIN32) defined (__WIN32__)) localtime_s (&snapshot, &time); // Microsoft-specific #else localtime_r (&time, &snapshot); // POSIX #endif return snapshot; } }; // Returns the current time and date as a string. std::string current_time_and_date() { std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); time_t as_time_t = std::chrono::system_clock::to_time_t (now); std::stringstream ss; ss << std::put_time (&my_std::localtime (as_time_t), "%Y-%m-%d %X"); return ss.str(); } int main() { std::cout << "The current time is: " << current_time_and_date() << std::endl; std::cout << "Taking a nap for half-a-second..." << std::endl; std::this_thread::sleep_for (std::chrono::milliseconds (500)); // half-a-second std::cout << "The current time is: " << current_time_and_date() << std::endl; // 5-second ticker... std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); for (unsigned tick=0; tick<5; ++tick) { std::this_thread::sleep_until (now + std::chrono::seconds (tick)); std::cout << "Tick..." << std::endl; } std::this_thread::sleep_until ( now + std::chrono::seconds (5)); std::cout << "BOOM!" << std::endl; }


What are the best techniques for organic search engine optimization (SEO)?

One of the most SEO strategy is improving your Google organic search rankings. Despite the fact that Google constantly tweaks their search engine algorithm, there are some fundamental best practices to get you started on improving it.some best techniques for seo :1. Map Strategy To Audience & Competitive Insights2. Align Your Content & SEO Teams3. Make Mobile SEO A Priority4. Find Measurement & Reporting That Works5. Integrate SEO Data Across Teams


Related questions

How to use take and took in a sentence?

Take, future tense. I will take a nap. Took, past tense. I took a nap.


What is a sentence with the word profuse?

you ate a profuse amount of food, then you took a nap.


What does it mean when in sims 3 it says buzz crashed?

I don't know what it means, but I just took a nap


Why is it grammatically improper to say like?

Grammar is a finicky thing. The word "like" implies a relationship, and is interchangeable with "such as". If you say "like" after everything you say, quite often it wouldn't fit. For example, take the following sentence.[sic] "like, I totally like, took like an hour nap!"If we replace every "like" with "such as", then we can see our errors."[such as] I totally [such as] took [such as] and hour nap!"This would be much more effective."I took a nap that was nearly an hour long!"


How do get rid of a headache?

nap nap and nap some more


What does hare mean?

speed and being full of yourself like the story the turtle and the hare the turtle was slow but concentrated and took its time while the hare took off and got tired. so he took a nap saying well hes way behind. i can beat him even if i took a nap so while the hare is being full of himself taking his nap thinking there is no way he can lose. here comes the turtle beating the hare. i hope i helped if this is not what you wanted im sorry


What mountain was it in southeastern new york that rip van winkle took a nap?

roundtop mountain in s.e. greene co. N.Y.


What do the bumbles do in the abominable snowman?

The looked for barried treasure then got tired and took a nap then woke up and pooped it was black with sparkles


Did Sigmund Freud sleep or nap?

nap


What is the opposite term of race?

nap nap


Are cats heavy sleepers?

No, not ussually anyway. Cats take nap after nap after nap to get their rest.


If I took a nap during the day around 1 pm do I still need 8-10 hours of sleep at night To be fully focused and ready for a workout or the day?

You will still need 8 hours of sleep a night even if you had a 1 hour nap.