|
| ||||||||||
| Tags: c language, ctime, function, header files |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| C : Implementation of ctime()
|
|
#2
| ||||
| ||||
| 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
| |||
| |||
| 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
| ||||
| ||||
| 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
| ||||
| ||||
| 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. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "C : Implementation of ctime()" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Finding ctime,mtime and atime | John Wilson | Operating Systems | 5 | 12-03-2010 08:13 PM |
| Implementation of mkfifo() : C | Garett | Software Development | 4 | 02-02-2010 06:27 PM |
| Implementation of mkdir() : C | Agustíne | Software Development | 4 | 02-02-2010 05:16 PM |
| C : Implementation of sin(),pow(),sqrt() | Adolfa | Software Development | 4 | 30-01-2010 11:41 AM |
| How to convert CString to CTime | Heather5 | Software Development | 3 | 03-09-2009 09:13 PM |