View Poll Results: Do you use the system time in your apps?

Voters
8. You may not vote on this poll
  • Yes.

    4 50.00%
  • Sometimes.

    2 25.00%
  • No.

    2 25.00%

Using System Clock

This is a discussion on Using System Clock within the C++ Programming forums, part of the General Programming Boards category; Hi there! I'm going on with my program, so I've got an another program. Sorry for asking this much, but ...

  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    105

    Using System Clock

    Hi there!

    I'm going on with my program, so I've got an another program. Sorry for asking this much, but this is the only useful resource I've got.
    My current problem is that I'd like to display the time in my software. How can I obtain the date and the time from Windows? Is there an object which does this?

    Thanks again, and vote!

    Han

  2. #2
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801
    Clicky


    The tm structure should help you.

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    105
    Sorry for that. I didn't know it's bad. I just like to know the opinion of people about the topics. Even of those, who actually don't want to answer, or suggest anything.
    But if it disturbs you, than it's okay. I won't make new polls.

    ByZ
    Han

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    polls are ok, when they make sense. but you're asking for information here.

    -I can answer

    -I can't answer

    -leave me alone

    are nonsensical poll options wouldn't you say? In any case, go ahead and use them if it helps things somehow.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    105
    I don't want to save the world in these polls. Mostly I'd just like to know for example: how often do people use this and that, how do they like it, and stuff. If it is nonsensical to you, then -as I said- I won't make more. (personally I like polls mostly, except when they ask me what kind of toothpaste do I use)
    BTW: Do you HAVE to answer to the polls, when you view this tread? (I'm asking, because I haven't seen any thread with polls, except mine of course - I thought voting is optional.)

    ByZ
    Han

  6. #6
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801
    The only problem with putting a poll on a question like this is that the question is answered in the first couple of posts, after this it has served it's purpose and not much more learning can be obtained from it. But if you put a poll on it then every time someone votes, the thread is shoved to the top of the list again and can hang around for a while.

    Not having a go at you or anything, just pointing it out.

  7. #7
    Registered User
    Join Date
    Apr 2003
    Posts
    3
    kongbangwa...
    GEEZ just answer the guy/girl's question!
    Here you go....here is some code from an alarm clock program I made for my PC.

    SYSTEMTIME SysTime;

    WORD wHour = SysTime.wHour;
    WORD wMinute = SysTime.wMinute;
    WORD wSecond = SysTime.wSecond;

    you can also assign some vars the month, day and year if you need the date.

  8. #8
    Registered User
    Join Date
    Nov 2002
    Posts
    126
    This is real simple...if all you want to do is display the current time and date and you don't need to do any calcuations on it, you can do this:

    Code:
    #include <iostream>
    #include <ctime>
    
    int main() {
    
           time(NULL); //returns number of seconds from 1970 or somethin....
           std::cout <<ctime(time(NULL)); //returns time formatted as current month, day, year, time
    //...or somethin along those lines, just try it out 
    
    }

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    105
    Thanks for the ideas! However I looked around and found one myself too. It's of the same complexity as the ones you've written.
    Back to polls: I voted for some polls yesterday, and I realized too, that it puts the polled thread to the top. This is not a good idea, I thought it doesn't work this way -its pretty illogical. The polls I made were mostly closed on the same day I made them as you see.

    ByZ
    Han

  10. #10
    Registered User
    Join Date
    Mar 2003
    Posts
    105
    Great idea! (I mean the General forum.)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Logical Error in Clock program
    By SVXX in forum C++ Programming
    Replies: 0
    Last Post: 05-10-2009, 12:12 AM
  2. Outside influences on clock cycles? (clock_t)
    By rsgysel in forum C Programming
    Replies: 4
    Last Post: 01-08-2009, 05:15 PM
  3. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  4. New system build wont boot
    By lightatdawn in forum Tech Board
    Replies: 7
    Last Post: 12-02-2005, 05:58 AM
  5. BIOS system and memory allocation problem
    By beely in forum Tech Board
    Replies: 9
    Last Post: 11-25-2003, 06:12 AM

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