return (State = AlarmState.On || State = AlarmState.Snooze) & Return (State != AlarmState.Off & Hour = when.Hour & Minute = when.Minute & Second = when.Second) This is the matches method that I'm using: // Returns whether alarm should go off at time "when". Thread.Sleep(1000) // pause for a secondĬurrTime = DateTime.Now // update current time If (alarm.Matches(snoozeTime) & alarm.State = AlarmState.Snooze) Continually show current time until alarm time reached.Ĭonsole.WriteLine("Current time is: ", snoozeTime) This is the relevant part of the main program: // Get current time. However, the alarm never seems to match the snoozeTime, even though when I print snoozeTime it looks like it matches.Īlso, if you're curious why I'm setting snooze for just 5 seconds in the future, it's because I can't figure out how to use keypresses yet. Right now, the state changes and the snoozeTime variable is set properly. It loops through the array and if one alarm matches the current time and the AlarmState is "On" the alarm goes off, sets a DateTime variable of "snoozeTime" to 5 seconds in the future, and changes the state to "Snooze." However, if it loops through the array and one alarm matches the snoozeTime as well as the state is "Snooze" then it changes the alarm state to "Off." The way it works right now is that a couple of alarms are loaded when the program starts.Įach alarm is an object of an Alarm class added to an array with the enum AlarmState set to "On". Ironically, sleeping 7 hours may leave you feeling less rested than sleeping for 6.5 hours, which explains why sometimes you wake up feeling exhausted even if you clocked plenty of hours in bed.I have to modify an alarm program for class and I can't see why it's not working. That would mean sleeping either 6.5 or 8 hours. If your sleep cycles tend to be 90 minutes in length, then you may want to plan your sleep schedule so that you wake up at the end of a 90-minute increment. Waking up at the end of a cycle could be even more important than the number of hours you spend asleep. If you wake up in the middle of a 100-minute sleep cycle, for example, you may be more tired than if you woke up at the end of one. You can also increase your chances of waking up feeling rested by timing your sleep schedule to correspond with sleep cycles. The number of hours isn’t the only thing to consider when breaking the habit. So, if you need seven hours of sleep and you have to be up at 6 a.m., you should be asleep by 11 p.m. The trick to getting enough rest is to determine your wake-up time and then plan your bedtime accordingly. Everyone’s sleep needs are different, with some people able to thrive on just 6.5 hours of sleep while other people need a couple more hours. Most Americans are sleep deprived, which makes hitting snooze in the morning a nationwide epidemic.īy getting enough sleep, you should be more likely to wake up in the morning ready to face the day without crawling back under the covers. The first step in breaking the snooze addiction to is to ensure that you’re getting enough sleep. These periods of fragmented sleep are not restful, and they can make you feel even groggier. But, when someone presses snooze, they’re depriving the body of REM. Typically, as the night goes on, the REM cycle lengthens. To feel rested, people need to spend enough time in REM, which happens at the tail end of a sleep cycle. During these cycles, humans experience five stages of sleep ranging from light sleep to deep sleep and REM (rapid eye movement). The reason is that people sleep in cycles of about 90 to 110 minutes. Pressing snooze, even just once, provides you with close to zero benefits, and could even be harmful to your health. When General Electric introduced the first alarm clock with a snooze button in 1956, the idea was that you could wake up gently and at your own pace instead of being jolted awake by a screeching buzz.Ī few extra minutes of snuggling with your partner or pet before starting your day is okay, and the snooze button is a fantastic insurance policy for making sure you don’t fall back into a deep sleep and miss your morning meetings, but things have gotten out of hand.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |