stopclock.h/.cpp

I made this for my other projects on the 13th (September). What it does is stops the message for specified time. Default is 3 seconds. NOTE: you need both .cpp and .h for this to work. Please leave the comments in it.

STOPCLOCK.H

  • //////////////////////////////////////////////////
    //////// StopClock.h /////////////////////////////
    //////// Put together by: Hunter Huttger /////////
    //////// Aliases: prototype, hhuttger ////////////
    //////// Date Created: Sep 13, 2009 //////////////
    /************************************************/
    //////// Used for: call the function to stop /////
    //////// the text being shown for specified //////
    //////// time. NOTE: This is only used in ////////
    //////// Windows. Linux users have no use ////////
    //////// for this. Please use responsibly. ///////
    /************************************************/
    //////// Used with: StopClock.cpp ////////////////
    //////////////////////////////////////////////////

    #ifndef STOPCLOCK_H
    #define STOPCLOCK_H

    void StopClock();

    #endif

  • STOPCLOCK.CPP

  • //////////////////////////////////////////////////
    //////// StopClock.cpp ///////////////////////////
    //////// Put together by: Hunter Huttger /////////
    //////// Aliases: prototype, hhuttger ////////////
    //////// Date Created: Sep 13, 2009 //////////////
    /************************************************/
    //////// Used for: call the function to stop /////
    //////// the text being shown for specified //////
    //////// time. NOTE: This is cross platform //////
    //////// so all you Linux and Windows users //////
    //////// can use this too. :-) ///////////////////
    /************************************************/
    //////// Used with: StopClock.h //////////////////
    //////////////////////////////////////////////////

    #include
    #include
    #include

    void StopClock()
    {
    int seconds = 1;
    #ifdef WIN32
    Sleep(seconds*3000); // Change the 3000 to whatever you want (hint: 3000 == 3 seconds)
    #else
    sleep(seconds);
    #endif
    }

    I know it’s really simple. But it works.

    To use the function in your code put

    StopClock();


    When you want to freeze time.

    If you have any name suggestions for me, please let me know.

  • Advertisement

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Connecting to %s

    Follow

    Get every new post delivered to your Inbox.