_TIME_

Discussion in 'C Programming' started by ramu, Aug 6, 2008.

  1. ramu

    ramu Guest

    Hi,
    Could you please let me know how to use _TIME_ macro with a
    sample code?

    Regards
     
    ramu, Aug 6, 2008
    #1
    1. Advertisements

  2. ramu

    Ian Collins Guest

    #include <stdio.h>

    int main(void)
    {
    puts(__TIME__);
    }
     
    Ian Collins, Aug 6, 2008
    #2
    1. Advertisements

  3. It's __TIME__, with 4 underscores:

    #include <stdio.h>

    int main (void) {
    puts(__TIME__);
    return 0;
    }
     
    Robert Gamble, Aug 6, 2008
    #3
  4. ramu

    CBFalconer Guest

    Reading the (easily available) standard is much faster. I.e:

    6.10.8 Predefined macro names

    [#1] The following macro names shall be defined by the
    implementation:

    .... snip ...

    __TIME__ The time of translation of the source file: a
    character string literal of the form "hh:mm:ss" as
    in the time generated by the asctime function. If
    the time of translation is not available, an
    implementation-defined valid time shall be
    supplied.

    Some useful references about C:
    <http://www.ungerhu.com/jxh/clc.welcome.txt>
    <http://c-faq.com/> (C-faq)
    <http://benpfaff.org/writings/clc/off-topic.html>
    <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf> (C99)
    <http://cbfalconer.home.att.net/download/n869_txt.bz2> (C99, txt)
    <http://www.dinkumware.com/c99.aspx> (C-library}
    <http://gcc.gnu.org/onlinedocs/> (GNU docs)
    <http://clc-wiki.net/wiki/C_community:comp.lang.c:Introduction>
     
    CBFalconer, Aug 7, 2008
    #4
  5. ramu

    santosh Guest


    The Standard isn't easily available at all from the perspective of a
    beginner. Even the existence of a Standard, it's Committee's website,
    and the presence of public drafts is unknown to the vast majority of
    newbies. Besides, the Standard document (or the draft) is _not_ a good
    place for a newbie to seek help. He would be much better off with
    almost any decent C book or tutorial.
    This would be most opaque to someone just starting out with C. Terms
    like "implementation", "translation", "character string
    literal", "asctime", "implementation-defined valid time" etc., are
    likely to be confusing at best.

    <snip>
     
    santosh, Aug 7, 2008
    #5
  6. ramu

    Richard Guest

    very well said. There is hope for you yet.
     
    Richard, Aug 7, 2008
    #6
  7. ramu

    CBFalconer Guest

    That's why I attached a list of places to get such things, which
    you snipped. Most newbies accessing Usenet have access to the WWW
    system.
     
    CBFalconer, Aug 7, 2008
    #7
  8. ramu

    santosh Guest

    That still leaves unsolved the difficulty for a newbie of comprehending
    the Standard's language. The C Standard is only accessible for someone
    already fairly experienced with C (at least a year I would say), unless
    the person were extraordinarily bright.
     
    santosh, Aug 7, 2008
    #8
  9. ramu

    CBFalconer Guest

    Well, we definitely disagree here. :) Being fairly facile in
    English is probably needed, though.
     
    CBFalconer, Aug 7, 2008
    #9
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...