Using system time in Linux C

Source: Internet
Author: User

Asctime (the time and date are represented in string format)
Related functions

Time,ctime,gmtime,localtime

Table header File

#include

Defining function .h>

char * asctime (const struct TM * timeptr);

Function description

Asctime () Turns the information in the TM structure referred to by the parameter timeptr

Change the time-date representation method used by the real-world, and then the result in Word

The character string form returns. This function has been converted from time zone to local time, string

The format is:

"Wed June 21:49:08 1993\n"

return value

Returns a string representing the current local time date.


Additional Instructions

If the associated time-date function is called again, the string may be corrupted. This function differs from CTime in that the parameters passed in are different structures.

Example

    1. #include <time.h>main () {time_t timep;time (&TIMEP);p rintf ("%s", Asctime (Gmtime (&TIMEP)));}

Executive Sat Oct 28 02:10:06 2000

CTime (the time and date are represented in string format)
Related functions

Time,asctime,gmtime,localtime

Table header File

#include

Defining function .h>

Char *ctime (const time_t *TIMEP);

Function description

CTime () Turns the information in the time_t structure referred to by the parameter TIMEP

Change the time-date representation method used by the real-world, and then the result in Word

The character string form returns. This function has been converted from time zone to local time, string

The format is "Wed June 21:49:08 1993\n". If you call the relevant

Time-Date function, this string may be corrupted.

return value

Returns a string representing the current local time date.

Example

    1. #include <time.h>main () {time_t timep;time (&TIMEP);p rintf ("%s", CTime (&TIMEP));}


Executive Sat Oct 28 10:12:05 2000


This article is from the "canvas shoes can walk the cat step" blog, please be sure to keep this source http://9409270.blog.51cto.com/9399270/1863784

Using system time in Linux C

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.