Giter Club home page Giter Club logo

ideal-morning-alarm's Introduction

test

Program to find ideal morning alarm. Basically just copying Sleep Calculator but I'm doing this to learn more, & test myself. Also, I have my browser set to be blocked after 10 pm so might as well make a simple .exe file to put on my desktop.

Basic functionality

  • 1. wake at x (keep deducting 90 mins, show between 4 & 6 cycles)
  • 2. go to bed at x (add 90 mins, show at same cycles as above)
    • call same f'n used for 3, just change arguement to custom user input.
  • 3. go to bed exactly now
    • convert to am/pm using strftime?
  • 4. power nap (wake up during N1,N2 stage or end of cycle)
        check how the site has done this
    • doesn't show print statements inside main() along with getch. instead, ends automatically after few seconds

Extra Functions after finishing above ones

  • instead of time, if 'b' entered, go back to menu

  • Order functions based on which ones may get called 1st. To improve code readability.

  • for go to beds & power naps, add 15 mins as time to sleep. inform user about this

  • Settings:

    • Change time to sleep. need to implement a way to make this change permanent. file handling prob
    • Daylight savings time. this should be permanent too prob have program read from file & assign values to variables at start of execution

ideal-morning-alarm's People

Contributors

dinesh-58 avatar

Watchers

 avatar

ideal-morning-alarm's Issues

Logic error with sleep times for option 1

Bug occurs due to how comparison between current time & sleep time (identifier is wake_time in program) is implemented.

time_value[0] = p_cur_time->tm_hour * 60 + p_cur_time->tm_min; 
time_value[1] = wake_time.tm_hour * 60 + wake_time.tm_min;
if (time_value[1] >= time_value[0]) {
    //print wake_time value
}

The 2 are compared so that the program only shows you sleep times that are practical. If it is 10 pm then you cannot possibly sleep at 9:50 pm. Thus the program won't show you that. Below are exaxmples where issues may occur.

  1. : You use option 1 at 12 AM. The hour value for this will be 0. Thus, the program might show
  2. : Let's say you use the tool at 7:00 AM & wanted to calculate when you should sleep to wake up at 7:30 AM tomorrow. You use option 1 & enter 7:30 AM. The sleep time values will be 10:30 PM, 12:00 AM, & 1:30 AM. The last 2 values won't be shown since hour values will be 0 & 1 & time_value[1] will be lesser.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.