Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <time.h>
    char * ctime( const time_t *timer );
    char *_ctime( const time_t *timer, char *buf );
    wchar_t * _wctime( const time_t *timer );
    wchar_t *__wctime( const time_t *timer, wchar_t *buf );

Description:
    The ctime functions convert the calendar time pointed to by timer to
    local time in the form of a string.  The ctime function is equivalent to


         asctime( localtime( timer ) )

    The ctime functions convert the time into a string containing exactly 26
    characters.  This string has the form shown in the following example:


         Sat Mar 21 15:58:27 1987\n\0

    All fields have a constant width.  The new-line character '\n' and the
    null character '\0' occupy the last two positions of the string.

    The ANSI function ctime places the result string in a static buffer that
    is re-used each time ctime or  asctime is called.  The non-ANSI function
     _ctime places the result string in the buffer pointed to by buf.

    The wide-character function  _wctime is identical to ctime except that
    it produces a wide-character string (which is twice as long).  The
    wide-character function  __wctime is identical to  _ctime except that it
    produces a wide-character string (which is twice as long).

    Whenever the ctime functions are called, the  tzset function is also
    called.

    The calendar time is usually obtained by using the  time function.  That
    time is Coordinated Universal Time (UTC) (formerly known as Greenwich
    Mean Time (GMT)).

    The time set on the computer with the DOS time command and the DOS date
    command reflects the local time.  The environment variable TZ is used to
    establish the time zone to which this local time applies.  See the
    section The TZ Environment Variable for a discussion of how to set the
    time zone.

Returns:
    The ctime functions return the pointer to the string containing the
    local time.

Example:
    #include <stdio.h>
    #include <time.h>

    void main()
      {
        time_t time_of_day;
        auto char buf[26];

        time_of_day = time( NULL );
        printf( "It is now: %s", _ctime( &time_of_day, buf ) );
      }

    produces the following:

    It is now: Fri Dec 25 15:58:42 1987

Classification:
    ctime is ANSI, _ctime is not ANSI, _wctime is not ANSI, __wctime is not
    ANSI

Systems:
     ctime - All, Netware

    _ctime - All
    _wctime - All
    __wctime - All

See Also:
    asctime, clock, difftime, gmtime, localtime, mktime, strftime, time,
    tzset

See Also: clock difftime

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson