Results 1 to 5 of 5

Thread: C : Implementation of ctime()

  1. #1
    Join Date
    Dec 2009
    Posts
    31

    C : Implementation of ctime()

    Hello, I am the student of the MCA first year. I had learn the C language in the BscIT. I know about some of the header files of the C language. So, I want to know about the ctime() function. I also want to know about the what is actual use of the ctime() function, How ctime() function works, and How can I implement the ctime() function in the C language. If anyone has the any idea about the ctime() function, so Please reply me.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Implementation of ctime()

    Hi, The calendar time that is pointed to by timer to the local time can be converted by the ctime() function basically in the form of string consisting of 26 characters exactly. Example of this string can be shown in form of the following :
    Sun Feb 22 15:58:27 1988\n\0
    The syntax of the ctime() function can be as follows :
    #include <time.h>
    char *_ctime( const time_t *timer, char *buf );

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: C : Implementation of ctime()

    I guess you should understood from the following explanation. If the ctime() function is an ANSI function then it places the resultant string in a static buffer that can be used again every time whenever the ctime() function can be called. If the ctime() function is an NON-ANSI function then it places the resultant string in the buffer that can be pointed to by buf. The tzset() function can also be called whenever the ctime() function is being called.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    C : Implementation of ctime()

    The following sample program helps you to understand ctime() function more easily :
    #include <stdio.h>
    #include <time.h>
    void main()
    {
    time_t timfdy;
    char bf[26];
    timfdy = time( NULL );
    printf( " It is now: %s ",
    ctime( &timfdy, bf ) );
    }
    The output of the above program can be :
    It is now: Sat jan 25 15:58:42 1988

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: C : Implementation of ctime()

    By using the time() function the calender time can be obtained. That calender time can be generally Co-ordinated Universal Time. This UTC can be known as the GMT that means Greenwich Mean Time. The time set on the computer with the QNX date command reflects Coordinated Universal Time. The environment variable that is TZ can be used to established the local time zone.

Similar Threads

  1. Finding ctime,mtime and atime
    By John Wilson in forum Operating Systems
    Replies: 5
    Last Post: 12-03-2010, 09:13 PM
  2. Implementation of mkfifo() : C
    By Garett in forum Software Development
    Replies: 4
    Last Post: 02-02-2010, 07:27 PM
  3. Implementation of mkdir() : C
    By Agustíne in forum Software Development
    Replies: 4
    Last Post: 02-02-2010, 06:16 PM
  4. C : Implementation of sin(),pow(),sqrt()
    By Adolfa in forum Software Development
    Replies: 4
    Last Post: 30-01-2010, 12:41 PM
  5. How to convert CString to CTime
    By Heather5 in forum Software Development
    Replies: 3
    Last Post: 03-09-2009, 09:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,243,732.24431 seconds with 17 queries