Ahg! Time!

Discussion in 'C++' started by HardHackz@gmail.com, Mar 1, 2007.

  1. Guest

    Okay, well, I found out how to get the username:

    getenv("username")

    Now, I want to get the time. I've tried including time.h and doing:

    time() or localtime()

    And there is some error in time.h because something has to few
    arguments in time.h...some help?

    Thanks in advance,
    ..::HardHackz::.
     
    , Mar 1, 2007
    #1
    1. Advertising

  2. Arun Guest

    On Mar 1, 12:01 pm, wrote:
    > Okay, well, I found out how to get the username:
    >
    > getenv("username")
    >
    > Now, I want to get the time. I've tried including time.h and doing:
    >
    > time() or localtime()
    >


    you could try gettimeofday.


    > And there is some error in time.h because something has to few
    > arguments in time.h...some help?
    >


    ??? what error ???

    > Thanks in advance,
    > .::HardHackz::.


    -A
     
    Arun, Mar 1, 2007
    #2
    1. Advertising

  3. red floyd Guest

    wrote:
    > Okay, well, I found out how to get the username:
    >
    > getenv("username")
    >
    > Now, I want to get the time. I've tried including time.h and doing:
    >
    > time() or localtime()
    >
    > And there is some error in time.h because something has to few
    > arguments in time.h...some help?
    >


    You have an error on line 42 of your code.

    In other words, we're not psychic. We don't know what error you've got,
    what your code looks like, etc...

    Post a minimal, *COMPILABLE* example, along with the errors, and
    expected behavior, and then we can help.

    See http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.8
     
    red floyd, Mar 1, 2007
    #3
  4. wrote:
    > Okay, well, I found out how to get the username:
    >
    > getenv("username")
    >
    > Now, I want to get the time. I've tried including time.h and doing:
    >
    > time() or localtime()
    >
    > And there is some error in time.h because something has to few
    > arguments in time.h...some help?


    RTFM. 'time' requires one argument - the pointer to a time_t object.
    You may pass 0 but you can't just omit it. 'localtime' requires one
    argument as well, what do you pass, nothing? RTFM

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Mar 1, 2007
    #4
  5. wrote:
    > Okay, well, I found out how to get the username:
    >
    > getenv("username")
    >
    > Now, I want to get the time. I've tried including time.h and doing:
    >
    > time() or localtime()
    >
    > And there is some error in time.h because something has to few
    > arguments in time.h...some help?
    >
    > Thanks in advance,
    > .::HardHackz::.
    >


    The time interface is really wierd. Designed in the bad old days when
    no-one knew the difference between a good interface and a bad one.

    But it's not too complex, you can pick it up pretty quickly, just look
    at one of the many references on the internet, or in a book. Do that,
    and if you still have questions ask again.

    john
     
    John Harrison, Mar 1, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. engsol
    Replies:
    2
    Views:
    994
    Dan Bishop
    Jan 26, 2004
  2. Replies:
    8
    Views:
    509
    Magnus Lycka
    Aug 5, 2005
  3. Peter Hansen
    Replies:
    0
    Views:
    735
    Peter Hansen
    Feb 22, 2006
  4. Peter Hansen
    Replies:
    0
    Views:
    630
    Peter Hansen
    Feb 22, 2006
  5. flamesrock
    Replies:
    8
    Views:
    553
    Hendrik van Rooyen
    Nov 24, 2006
Loading...

Share This Page