Making an Allam clock...

This is a discussion on Making an Allam clock... within the C Programming forums, part of the General Programming Boards category; Guys in our class we were required to make a alarm clock... and i absolutely have no idea on making ...

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    19

    Making an Allam clock...

    Guys in our class we were required to make a alarm clock... and i absolutely have no idea on making it....

    you might say: "ughhh not another noob request! make me this thing and that... why wont he make it himself!?"

    Well i;m not gona ask an instant code/program, but rather advice on what specific libraries and even code to look upon. Like ctime or time.h , well google is not specifically helping me on what i need. thats why i;m asking to you guys that have more experience on this.

    i really want to make my own code/program and have full understanding on making it.
    I;m looking for how to display time from desktop to the program and also prompt a time and make an alarm on it...

    guys please help! thanks in advance.

  2. #2
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    Noobs need to learn that when they ask what libs to use, they need to specify what type of interface they want to have and what system they're targeting.

    GUI or text, Windows or *nix?

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    IMO the right to do this is to use the OS. Make a cron job (Linux), or a Scheduled Task (Windows).

    However...

    printf("\a\a");

    should make a "beep" or two, if you have a buzzer on your mobo.

    Depending on your compiler, either sleep() or delay() should give you a pause between checking to see if the time is right for the alarm to sound. Both functions need the
    #include <dos.h>

    To make your alarm clock smart, I'd vary how long it sleeps or delays. Instead of checking say, every single second, work out a little arithmetic so if the alarm is set to go off, in 1 minute, your programs begins checking every second or even half second. But if the alarm time is a long way off - more than a minute say. Then the sleeps or delays would be longer.

    There are a bunch of time functions. All of them require
    #include <time.h>

    localtime() looks promising for this, but it's not really simple to understand how to code it up.

    But see if your compiler has localtime(), (and if not, what time functions does it have that you could use).

    Post up your starting code, however meager it may be, and then we can see what you need.

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,167
    Quote Originally Posted by Adak View Post
    #include <dos.h>
    Scratch that. Let's use Windows.h and Sleep for Windows and <unknown-header> and sleep for Linux.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    19
    Quote Originally Posted by User Name: View Post
    Noobs need to learn that when they ask what libs to use, they need to specify what type of interface they want to have and what system they're targeting.

    GUI or text, Windows or *nix?
    Sorry didnt know about that >_>

    Text and Windows

    Edit: i;m start my code tomorrow gota catch some zzZZZzzz thanks guys for the reply
    Last edited by jazzglenn421; 07-21-2010 at 01:57 PM.

  6. #6
    Password:
    Join Date
    Dec 2009
    Location
    NC
    Posts
    587
    I'm sorry if that sounded mean. It kinda was...

    Maybe these will help:
    alarm(S)
    sleep(C)

    I know Windows has a (limited) Unix subsystem, but does anyone here know if it supports unistd.h? I guess I could look it up, but I don't want to.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. making sprites
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 02-20-2010, 06:00 AM
  2. Logical Error in Clock program
    By SVXX in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2009, 12:12 AM
  3. Recreating Clock Code
    By alexisalexus in forum C Programming
    Replies: 2
    Last Post: 03-24-2009, 08:05 PM
  4. clock program
    By bazzano in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 10:12 PM
  5. Making great graphics
    By MadCow257 in forum Game Programming
    Replies: 1
    Last Post: 02-20-2006, 10:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21